Inbound Web Service Call Fails with HTTP-400 and Warning in Instance Node Log: Security restricted: Invalid x-forwarded-host header


Description

An inbound web service call fails and returns an HTTP-400 response to the client.

Checking the instance node logs at the time of the call shows an error like this:

 

020-03-25 08:22:29 (789) http-1 SYSTEM WARNING *** WARNING *** Security restricted: Invalid x-forwarded-host header: /10.10.10.10:5654
2020-03-25 08:22:29 (790) http-1 SYSTEM WARNING *** WARNING *** No active connections for the session/thread
2020-03-25 08:22:29 (790) http-1 SYSTEM SEVERE *** ERROR *** Uncaught exception in GlideTransactionProcessor.doRequest():
java.lang.IllegalArgumentException: Invalid x-forwarded-host header: /10.10.10.10:5654
at com.glide.sys.TransactionRequestInfo.<init>(TransactionRequestInfo.java:73)
at com.glide.sys.Transaction.setContext(Transaction.java:420)
at com.glide.ui.HTTPTransaction.setContext(HTTPTransaction.java:42)
at com.glide.sys.Transaction.<init>(Transaction.java:329)
at com.glide.ui.HTTPTransaction.<init>(HTTPTransaction.java:19)
at com.glide.sys.Transaction.create(Transaction.java:2571)
at com.glide.ui.GlideTransactionProcessor.doAsyncGlideServletTransaction(GlideTransactionProcessor.java:174)
at com.glide.ui.GlideTransactionProcessor.doRequest(GlideTransactionProcessor.java:109)
at com.glide.ui.GlideServlet.doRequest(GlideServlet.java:301)
at com.glide.ui.GlideServlet.doGet(GlideServlet.java:264)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at com.glide.ui.GlideServlet.service(GlideServlet.java:256)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:200)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
at org.apache.tomcat.util.net.Nio2Endpoint$SocketProcessor.doRun(Nio2Endpoint.java:1682)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

Release or Environment

Applies to any release.

Cause

The web service client making the inbound call has set the x-forwarded-host header with an invalid value, in this example:

x-forwarded-host header: /10.10.10.10:5654

The inclusion of the "/" makes the header invalid.

There can be many variations of an invalid header settings, this is just one example.

Resolution

The calling client must change the x-forwarded-host header sent to be a valid header, for the example used this would be a valid header:

x-forwarded-host header: 10.10.10.10:5654

Simply by removing the "/" the header is now valid.

For valid formats of this header refer to these sites:

https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
X-Forwarded-Host: en.wikipedia.org:8080
X-Forwarded-Host: en.wikipedia.org

And

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Host
X-Forwarded-Host: id42.example-cdn.com