Cannot configure bind address for http/https gateway server
See original GitHub issue(Note: I reported this on gitter and @kevinswiber suggested I file a bug.)
There’s a way to specify the bind address for the admin http server (via admin->hostname in gateway.config.yml) but you can’t currently configure the bind address for the main gateway http/https servers. This is specifically problematic when trying to run in a Docker container where you need it to bind to all interfaces (0.0.0.0) when running in “bridge” network mode, for example.
I took a stab at filing a PR for this. While adding support for the new config value is trivial, the problem I ran into is maintaining backwards compatibility such that folks that currently don’t have the hostname defined get the same behavior (binds to ‘::’ for IPv6, etc), but when I do specify the hostname, the tests break with errors like:
5) exact host name configuration
should not serve sub.abc.acme.com :
TypeError: Cannot read property 'address' of undefined
at Test.serverAddress (node_modules/supertest/lib/test.js:55:18)
at new Test (node_modules/supertest/lib/test.js:36:12)
at Object.obj.(anonymous function) [as get] (node_modules/supertest/index.js:25:14)
at prepareScenario (test/common/routing.helper.js:16:35)
at Context.<anonymous> (test/common/routing.helper.js:73:30)
I think this is because node’s net.server.address()
returns an object if you don’t specify a hostname (current behavior) or a String if you do (new behavior). (See https://nodejs.org/api/net.html#net_server_address), but I can’t tell if this is just an issue with the tests, or if the rabbit hole goes deeper.
This may be easier than I think and I’m just not familiar with the code base. Any pointers in the right direction so I can file a PR would be much appreciated. Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:9 (9 by maintainers)
Top GitHub Comments
Got it. I’ll try to have a look today or tomorrow. Thanks!
@XVincentX yup, will push that up when I get to work in a couple hours. Stay tuned…