devilbox
devilbox copied to clipboard
Allow curl to reach external .com sites when TLD_SUFFIX is set to .com
ISSUE TYPE
- Feature request
SUMMARY
Change the behavior of Bind to allow for setting the TLD_SUFFIX to *.com, but allow curl to bypass the devilbox httpd server and follow real DNS to external servers.
To clarify the technical restraints:
Bind needs to be configured in a way not to do catch-all on the TLD_SUFFIX, but to be aware about all currently existing projects and only create DNS entries for those.
Could this be achieved by having the vhost detection build up a EXTRA_HOSTS string for bind to use?
Any way to change default catch-all behiviour right now? I find EXTRA_HOSTS could help a little.
How does bind currently work (https://github.com/cytopia/docker-bind)?
Whatever TLD_SUFFIX (WILDCARD_DNS in bind) is specified, bind uses that and all available sub-domains (catch-all) and makes them resolve by the IP address set.
When this is set to com
and the IP of the PHP container, then everything with a *.com
domain will be pointed to the PHP container. This is just how a catch-all works and I don't see any good idea how to change the implementation.
What else can you do?
Instead of specifying com
, use a subdomain, such as .dev.my-company.com
. This way the catch all will only be applied on subdomains of .dev.my-company.com
and all other .com
domains will still resolve normally.
This feature might actually become a real thing soon as I am currently splitting the DNS feature into an internal DNS and a host-based DNS container. Once everything has been merged into the v1.0.0 release, I can actually rewrite the internal DNS to only rewrite the URL's for which directories exist and leave everything else untouched (as a second iteration).
Initial PR here: https://github.com/cytopia/devilbox/pull/411
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
After stumbling upon the same problem, I thought another better solution: the DNS server may resolve ONLY the urls of specified projects, and ONLY them.
For example: I have a www.project
folder, and want to access it using www.project.test.io
(supposing I own test.io). I only need to set the TLD to test.local, everything if fine. But then, if I'm tricky, and want to also use uploads.project.test.io
to simply assets management between dev and demo env. I get a nice 404, since bind is resolving EVERYTHING to localhost, to devilbox interface.
Adding manually each domain to the server on folder reloads with a script would tackle this problem, and probably OP's one.