I'm currently trying to get a reverse proxy up and running using Spring Boot and Zuul. The HTTP part is working already. However if I'm trying to request a site via HTTPS e.g. curl https://twitter.com
then the request doesn't even reach my implemented logic.
The processing stops in the middle of normalizing the URL, because it looks like this: twitter.com:443
. The comment of the relevant code snippet is not that helpful.
// The URL must start with '/'
if (b[start] != (byte) '/') {
return false;
}
I'm using everything without much configuration, just server.port: 9999. Am I missing something here, or why does Tomcat not accept the request?
The relevant Stacktrace:
org.apache.catalina.connector.CoyoteAdapter.normalize(CoyoteAdapter.java:1172)
org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:623)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:336)
org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1455)
Update
In the mean time I figured out the difference. I want to use Zuul as a proxy for both HTTP and HTTPS. However the request that hits the server is not the same as with HTTP but the following:
CONNECT twitter.com:443 HTTP/1.1
Host: twitter.com:443
User-Agent: curl/7.54.1
Proxy-Connection: Keep-Alive
So is it even possible to build a HTTPS proxy using Spring Boot and Zuul?