Membrane API Gateway returns 500 Internal Server Error with the detail Could not rewrite endpoint! when the wsaEndpointRewriter plugin cannot process the body of a SOAP message. The cause is the message: the client's request or the backend's response.
The response contains the status 500 Internal Server Error, the detail Could not rewrite endpoint!, 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 message. The error can occur in the request and in the response flow; in both cases the client receives a 500. In production mode, the title is replaced by Internal Server Error and the details are left out.
The wsaEndpointRewriter plugin rewrites the WS-Addressing ReplyTo/Address of SOAP messages so that it points at the gateway instead of the original endpoint. The new address is built from the plugin's protocol, host and port. To do this, the plugin has to parse the whole message body as XML.
The body is empty, is not XML at all, or is not well-formed XML, for example because it was truncated.
The plugin uses a hardened XML parser that rejects DOCTYPE declarations to protect against XML attacks. A message with a DOCTYPE cannot be rewritten.
The address inside ReplyTo/Address is not a valid URI, or the Address element contains child elements instead of plain text.
The body could not be read or decoded, for example because the connection was closed early or the Content-Encoding is invalid.
Any other exception that the wsaEndpointRewriter plugin does not turn into an error response itself is reported under the same URL by Membrane's generic error handler. The detail then reads Aborting! Exception caused in … flow. and names the plugin, the request URI and the flow. Unless the exception points to your configuration or to the message, this usually indicates a bug in Membrane.
ReplyTo address.For SOAP in Membrane in general, see the SOAP tutorial.
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 ---. The response then only contains a log key. Search the gateway log for this key to find the exception.
If the plugin is nested inside a request, response or abort element, the exception message, the stack trace and the link to this page are currently sent even in production mode. Fix the failing plugin rather than relying on production mode to hide them.
Configuration reference:
Still stuck? See the troubleshooting guide or ask on GitHub Issues. For commercial support, contact info@predic8.de.