Membrane API Gateway returns 502 Bad Gateway when it cannot resolve the host name of the backend. The DNS lookup failed, so the request was not sent. The client is not at fault.
The response contains the status 502 Bad Gateway, a detail that names the host that could not be resolved, the problem type https://membrane-api.io/problems/gateway and a link to this page. The type gateway means that the problem lies between Membrane and an upstream system, not in the client's request.
The host name in the target of the API is misspelled or does not exist:
api:
port: 2000
target:
url: https://api.example.com
api:
port: 2000
target:
url: https://api.example.com
The name is valid, but not where Membrane runs. Internal names are often only known inside another network, a container network or a VPN.
Some networks resolve external names only on an HTTP proxy. If no proxy is configured for Membrane, the lookup fails. Membrane logs a hint about this together with the error.
An outgoing proxy is configured, but its own host name cannot be resolved.
detail field and correct the target of the API.nslookup or dig, and fix the DNS configuration of that host or container.configuration:
httpClientConfig:
proxy:
host: proxy.example.com
port: 3128
configuration:
httpClientConfig:
proxy:
host: proxy.example.com
port: 3128
By default, Membrane runs in development mode and adds details to error responses that help you find the problem, including the link to this page. These details may reveal information about your setup. In production, turn them off:
configuration:
production: trueconfiguration: production: true
Add the configuration document to your apis.yaml and separate it from the APIs with ---.
In production mode, the title of this error is replaced by Internal Server Error, and the response only says Internal details are hidden. See server log (key: ...). Search the gateway log for that key to find the full error message.
Configuration reference:
Tutorials with runnable examples:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.