Membrane API Gateway returns 502 Bad Gateway with the detail Backend closed the connection before the response was complete. when the backend starts to answer but closes the connection partway through the status line or the response headers. The backend or a network device between gateway and backend is to blame.
The response contains the status 502 Bad Gateway, the title Bad Gateway, the detail Backend closed the connection before the response was complete., the problem type https://membrane-api.io/problems/internal and a link to this page. The type internal means that the gateway could not complete the processing of the request. In production mode, the title is replaced by Internal Server Error and the details are left out.
The backend crashed, restarted or killed the worker that handled the request while it was writing the response head.
A load balancer, firewall or proxy between Membrane and the backend closed the connection, e.g. because of a request timeout.
The backend writes a response head without the line breaks HTTP requires and then closes the connection.
By default, Membrane runs in development mode and adds details to error responses that help you find the problem. 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 ---.
Configuration reference:
Tutorials with runnable examples:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.