Search code examples
springspring-mvchttp-redirectembedded-jettyjetty-9

Jetty 9.3.6 + Spring: HTTPS automatically redirected to HTTP


I don't know why but my HTTPS request are automatically redirected to HTTP, and that's a problem:

The original request:

Remote Address:127.0.1.1:7171
Request URL:https://w-rli09-ben:7171/main/app/test
Request Method:GET
Status Code:302 Found

Response Headers:

Content-Length:0
Date:Sat, 16 Jan 2016 01:02:11 GMT
Location:http://w-rli09-ben:7171/main/login
Server:Jetty(9.3.z-SNAPSHOT)

The Jetty + Spring DEBUG logs:

2016-01-15 16:58:58 DEBUG o.e.j.s.session:347 - Scavenging sessions at 1452905938843
2016-01-15 16:58:58 DEBUG o.e.j.i.ManagedSelector:234 - Selector loop woken up from select, 1/1 selected
2016-01-15 16:58:58 DEBUG o.e.j.i.SelectChannelEndPoint:159 - onSelected 1->0 r=true w=false for SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14176/30000,SslConnection}{io=1/0,kio=1,kro=1}
2016-01-15 16:58:58 DEBUG o.e.j.i.SelectChannelEndPoint:186 - task SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14176/30000,SslConnection}{io=1/0,kio=1,kro=1}:runFillable
2016-01-15 16:58:58 DEBUG o.e.j.u.t.s.ExecuteProduceConsume:165 - EPR Prod/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48 produced SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14176/30000,SslConnection}{io=1/0,kio=1,kro=1}:runFillable
2016-01-15 16:58:58 DEBUG o.e.j.u.t.s.ExecuteProduceConsume:206 - EPR Pend/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48 dispatch
2016-01-15 16:58:58 DEBUG o.e.j.u.t.QueuedThreadPool:373 - queue EPR Pend/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48
2016-01-15 16:58:58 DEBUG o.e.j.u.t.s.ExecuteProduceConsume:212 - EPR Pend/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48 run SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14176/30000,SslConnection}{io=1/0,kio=1,kro=1}:runFillable
2016-01-15 16:58:58 DEBUG o.e.j.u.t.QueuedThreadPool:571 - run EPR Pend/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48
2016-01-15 16:58:58 DEBUG o.e.j.u.t.s.ExecuteProduceConsume:125 - EPR Pend/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48 run
2016-01-15 16:58:58 DEBUG o.e.j.u.t.s.ExecuteProduceConsume:154 - EPR Prod/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48 produce enter
2016-01-15 16:58:58 DEBUG o.e.j.u.t.s.ExecuteProduceConsume:160 - EPR Prod/org.eclipse.jetty.io.ManagedSelector$SelectorProducer@6325da48 producing
2016-01-15 16:58:58 DEBUG o.e.j.i.FillInterest:93 - FillInterest@3cdb3cea{true,AC.ReadCB@19aa1a49{SslConnection@19aa1a49{NOT_HANDSHAKING,eio=-1/-1,di=-1} -> HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14177/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14176/30000,SslConnection}{io=1/0,kio=1,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}]}} fillable AC.ReadCB@19aa1a49{SslConnection@19aa1a49{NOT_HANDSHAKING,eio=-1/-1,di=-1} -> HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14178/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14177/30000,SslConnection}{io=1/0,kio=1,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}]}
2016-01-15 16:58:58 DEBUG o.e.j.i.SelectChannelEndPoint:214 - Key interests updated 1 -> 0 on SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14177/30000,SslConnection}{io=0/0,kio=0,kro=1}
2016-01-15 16:58:58 DEBUG o.e.j.i.s.SslConnection:184 - onFillable enter DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14178/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,14177/30000,SslConnection}{io=0/0,kio=0,kro=1}
2016-01-15 16:58:58 DEBUG o.e.j.i.ManagedSelector:231 - Selector loop waiting on select
2016-01-15 16:58:58 DEBUG o.e.j.i.FillInterest:93 - FillInterest@b5aba24{true,AC.ReadCB@67ba0184{HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14178/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,14177/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}]}} fillable AC.ReadCB@67ba0184{HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,FI,-,14178/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,14177/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}]}
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:215 - HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,-,14178/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,14177/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}] onFillable enter HttpChannelState@622e0999{s=IDLE a=null i=true r=!P!U w=false} null
2016-01-15 16:58:58 DEBUG o.e.j.i.ChannelEndPoint:147 - filled 501 SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,14178/30000,SslConnection}{io=0/0,kio=0,kro=1}
2016-01-15 16:58:58 DEBUG o.e.j.i.s.SslConnection:517 - SslConnection@19aa1a49{NOT_HANDSHAKING,eio=0/-1,di=-1} -> HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,-,14179/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,0/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}] net=501 unwrap Status = OK HandshakeStatus = NOT_HANDSHAKING bytesConsumed = 501 bytesProduced = 449
2016-01-15 16:58:58 DEBUG o.e.j.i.s.SslConnection:518 - SslConnection@19aa1a49{NOT_HANDSHAKING,eio=0/-1,di=-1} -> HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,-,14179/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,0/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}] filled b[449]=474554202F6D61696E2F6170702F7465737420485454502F31...3464380D0A0D0A
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:322 - HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,-,14180/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,1/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}] filled 449 HeapByteBuffer@3a5072bb[p=0,l=449,c=17408,r=449]={<<<GET /main/app/tes...ckog7sq64d8\r\n\r\n>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:339 - HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,-,14180/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,1/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=1,c=false,a=IDLE,uri=null}] parse HeapByteBuffer@3a5072bb[p=0,l=449,c=17408,r=449]={<<<GET /main/app/tes...ckog7sq64d8\r\n\r\n>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00} {}
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1163 - parseNext s=START HeapByteBuffer@3a5072bb[p=0,l=449,c=17408,r=449]={<<<GET /main/app/tes...ckog7sq64d8\r\n\r\n>>>\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - START --> SPACE1
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - SPACE1 --> URI
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - URI --> SPACE2
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - SPACE2 --> REQUEST_VERSION
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - REQUEST_VERSION --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_IN_NAME
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_NAME --> HEADER_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_VALUE --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> HEADER_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_VALUE --> HEADER_IN_VALUE
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER_IN_VALUE --> HEADER
2016-01-15 16:58:58 DEBUG o.e.j.h.HttpParser:1542 - HEADER --> END
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpChannel:602 - HttpChannelOverHttp@79c35e68{r=2,c=false,a=IDLE,uri=//w-rli09-ben:7171/main/app/test} onRequestComplete
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpInput:385 - HttpInputOverHTTP@57be4401[c=0,s=STREAM] addContent EOF
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:344 - HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,-,14183/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,4/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=END,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=2,c=false,a=IDLE,uri=//w-rli09-ben:7171/main/app/test}] parsed true HttpParser{s=END,0 of -1}
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:192 - releaseRequestBuffer HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,-,14183/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,4/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=END,0 of -1},g=HttpGenerator@7a792b70{s=START},c=HttpChannelOverHttp@79c35e68{r=2,c=false,a=IDLE,uri=//w-rli09-ben:7171/main/app/test}]
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpChannel:271 - HttpChannelOverHttp@79c35e68{r=2,c=false,a=IDLE,uri=//w-rli09-ben:7171/main/app/test} handle //w-rli09-ben:7171/main/app/test 
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpChannelState:188 - HttpChannelState@622e0999{s=IDLE a=null i=true r=!P!U w=false} handling IDLE
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpChannel:284 - HttpChannelOverHttp@79c35e68{r=2,c=false,a=DISPATCHED,uri=//w-rli09-ben:7171/main/app/test} action DISPATCH
2016-01-15 16:58:58 DEBUG o.e.j.s.Server:506 - REQUEST on HttpChannelOverHttp@79c35e68{r=2,c=false,a=DISPATCHED,uri=//w-rli09-ben:7171/main/app/test}
GET //w-rli09-ben:7171/main/app/test
Host: w-rli09-ben:7171
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,fr;q=0.6
Cookie: JSESSIONID=4nughxn0sfm01qckog7sq64d8


2016-01-15 16:58:58 DEBUG o.e.j.s.h.ContextHandler:1007 - scope null||/main/app/test @ o.e.j.w.WebAppContext@4d4d48a6{/main,file:///work/main/webapp/,AVAILABLE}{/tmp/main.war}
2016-01-15 16:58:58 DEBUG o.e.j.s.h.ContextHandler:1084 - context=/main||/app/test @ o.e.j.w.WebAppContext@4d4d48a6{/main,file:///work/main/webapp/,AVAILABLE}{/tmp/main.war}
2016-01-15 16:58:58 DEBUG o.e.j.s.session:271 - Got Session ID 4nughxn0sfm01qckog7sq64d8 from cookie
2016-01-15 16:58:58 DEBUG o.e.j.s.session:179 - sessionManager=org.eclipse.jetty.server.session.HashSessionManager@eadb475
2016-01-15 16:58:58 DEBUG o.e.j.s.session:180 - session=org.eclipse.jetty.server.session.HashedSession:4nughxn0sfm01qckog7sq64d8@465612300
2016-01-15 16:58:58 DEBUG o.e.j.s.ServletHandler:497 - servlet /main|/app|/test -> dashboard@c18aea94==org.springframework.web.servlet.DispatcherServlet,1,true
2016-01-15 16:58:58 DEBUG o.e.j.s.ServletHandler:560 - chain=filterChainProxy->springSecurityFilterChain->encoding-filter->httpMethodFilter->dashboard@c18aea94==org.springframework.web.servlet.DispatcherServlet,1,true
2016-01-15 16:58:58 DEBUG o.e.j.s.ServletHandler:1657 - call filter filterChainProxy
2016-01-15 16:58:58 DEBUG o.s.s.w.u.m.AntPathRequestMatcher:145 - Checking match of request : '/app/test'; against '/j_spring_security_check'
2016-01-15 16:58:58 DEBUG o.s.s.w.u.m.AntPathRequestMatcher:145 - Checking match of request : '/app/test'; against '/login'
2016-01-15 16:58:58 DEBUG o.s.s.w.u.m.AntPathRequestMatcher:145 - Checking match of request : '/app/test'; against '/autologin'
2016-01-15 16:58:58 DEBUG o.s.s.w.u.m.AntPathRequestMatcher:145 - Checking match of request : '/app/test'; against '/services/**/*'
2016-01-15 16:58:58 DEBUG o.s.s.w.u.m.AntPathRequestMatcher:145 - Checking match of request : '/app/test'; against '/logout'
2016-01-15 16:58:58 DEBUG o.s.s.w.u.m.AntPathRequestMatcher:145 - Checking match of request : '/app/test'; against '/app/settings/**/*'
2016-01-15 16:58:58 DEBUG o.s.s.w.u.m.AntPathRequestMatcher:145 - Checking match of request : '/app/test'; against '/app/**/*'
2016-01-15 16:58:58 DEBUG o.s.s.w.FilterChainProxy:337 - /app/test at position 1 of 7 in additional filter chain; firing Filter: 'TestSchemeFilter'
2016-01-15 16:58:58 INFO  c.r.l.ConsoleLogger:42 - [SYSOUT] !!! TestSchemeFilter !!!
2016-01-15 16:58:58 INFO  c.r.l.ConsoleLogger:42 - [SYSOUT] requesturl:http://w-rli09-ben:7171/main/app/test
2016-01-15 16:58:58 INFO  c.r.l.ConsoleLogger:42 - [SYSOUT] uri:/main/app/test
2016-01-15 16:58:58 INFO  c.r.l.ConsoleLogger:42 - [SYSOUT] prefix:http://w-rli09-ben:7171
2016-01-15 16:58:58 DEBUG o.s.s.w.FilterChainProxy:337 - /app/test at position 2 of 7 in additional filter chain; firing Filter: 'ExceptionFilter'
2016-01-15 16:58:58 DEBUG o.s.s.w.FilterChainProxy:337 - /app/test at position 3 of 7 in additional filter chain; firing Filter: 'RequestContextFilter'
2016-01-15 16:58:58 DEBUG o.s.s.w.FilterChainProxy:337 - /app/test at position 4 of 7 in additional filter chain; firing Filter: 'SessionRequiredFilter'
2016-01-15 16:58:58 INFO  c.r.l.ConsoleLogger:42 - [SYSOUT] Going originally to:/main/login
2016-01-15 16:58:58 INFO  c.r.l.ConsoleLogger:42 - [SYSOUT] Going to absolute url:http://w-rli09-ben:7171/main/login
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpChannel:703 - Commit HTTP/1.1{s=302,h=2} to HttpChannelOverHttp@79c35e68{r=2,c=true,a=DISPATCHED,uri=//w-rli09-ben:7171/main/app/test}
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:680 - org.eclipse.jetty.server.HttpConnection$SendCallback@a8c3680[PROCESSING][i=HTTP/1.1{s=302,h=2},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@7f44a2b4] generate: NEED_HEADER (null,[p=0,l=0,c=0,r=0],true)@START
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:680 - org.eclipse.jetty.server.HttpConnection$SendCallback@a8c3680[PROCESSING][i=HTTP/1.1{s=302,h=2},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@7f44a2b4] generate: FLUSH ([p=0,l=155,c=8192,r=155],[p=0,l=0,c=0,r=0],true)@COMPLETING
2016-01-15 16:58:58 DEBUG o.e.j.i.WriteFlusher:306 - write: WriteFlusher@35e7026b{IDLE} [HeapByteBuffer@6d84d4be[p=0,l=155,c=8192,r=155]={<<<HTTP/1.1 302 Foun...z-SNAPSHOT)\r\n\r\n>>>Jan 1970 00:00:00...\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00}]
2016-01-15 16:58:58 DEBUG o.e.j.i.WriteFlusher:117 - update WriteFlusher@35e7026b{WRITING}:IDLE-->WRITING
2016-01-15 16:58:58 DEBUG o.e.j.i.s.SslConnection:717 - SslConnection@19aa1a49{NOT_HANDSHAKING,eio=-1/-1,di=-1} -> HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,W,14188/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,9/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=END,0 of -1},g=HttpGenerator@7a792b70{s=COMPLETING},c=HttpChannelOverHttp@79c35e68{r=2,c=true,a=DISPATCHED,uri=//w-rli09-ben:7171/main/app/test}] flush b[155]=485454502F312E312033303220466F756E640D0A446174653A...4F54290D0A0D0A
2016-01-15 16:58:58 DEBUG o.e.j.i.s.SslConnection:748 - SslConnection@19aa1a49{NOT_HANDSHAKING,eio=-1/197,di=-1} -> HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,W,14189/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,10/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=END,0 of -1},g=HttpGenerator@7a792b70{s=COMPLETING},c=HttpChannelOverHttp@79c35e68{r=2,c=true,a=DISPATCHED,uri=//w-rli09-ben:7171/main/app/test}] wrap Status = OK HandshakeStatus = NOT_HANDSHAKING bytesConsumed = 155 bytesProduced = 197
2016-01-15 16:58:58 DEBUG o.e.j.i.s.SslConnection:786 - SslConnection@19aa1a49{NOT_HANDSHAKING,eio=-1/197,di=-1} -> HttpConnection@67ba0184[DecryptedEndPoint@5059b0eb{/127.0.0.1:56564<->7171,Open,in,out,-,W,14189/30000,HttpConnection}->SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,10/30000,SslConnection}{io=0/0,kio=0,kro=1}][p=HttpParser{s=END,0 of -1},g=HttpGenerator@7a792b70{s=COMPLETING},c=HttpChannelOverHttp@79c35e68{r=2,c=true,a=DISPATCHED,uri=//w-rli09-ben:7171/main/app/test}] wrap OK b[197]=17030300C0E7AA73C1224516237095A2349193DBED5E5E7363...A52FE4BE6C8EC7
2016-01-15 16:58:58 DEBUG o.e.j.i.ChannelEndPoint:193 - flushed 197 SelectChannelEndPoint@33c50677{/127.0.0.1:56564<->7171,Open,in,out,-,-,10/30000,SslConnection}{io=0/0,kio=0,kro=1}
2016-01-15 16:58:58 DEBUG o.e.j.i.WriteFlusher:423 - Flushed=true 155/155+0 WriteFlusher@35e7026b{WRITING}
2016-01-15 16:58:58 DEBUG o.e.j.i.WriteFlusher:117 - update WriteFlusher@35e7026b{IDLE}:WRITING-->IDLE
2016-01-15 16:58:58 DEBUG o.e.j.s.HttpConnection:680 - org.eclipse.jetty.server.HttpConnection$SendCallback@a8c3680[PROCESSING][i=HTTP/1.1{s=302,h=2},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@7f44a2b4] generate: DONE ([p=155,l=155,c=8192,r=0],[p=0,l=0,c=0,r=0],true)@END
2016-01-15 16:58:58 DEBUG o.e.j.s.Server:520 - RESPONSE for /main/app/test h=true
302 null
Date: Sat, 16 Jan 2016 00:58:58 GMT
Location: http://w-rli09-ben:7171/main/login

As you can see, the first thing I do in the webapp is log the request info I receive from Jetty, and it's already in HTTP instead of HTTPS.

I tried to play with p:redirectHttp10Compatible, no luck there.

Some people say to create a filter that would fix the redirects and make them absolute, but the request that the filter gets has the wrong scheme already.

Any ideas?


Solution

  • You might have a bad setup of HttpConfiguration in your SSL/TLS layer on Jetty.

    That layer should include the SecureRequestCustomizer, so that information from the SSL/TLS layer can be properly included in your HttpServletRequest objects.

    Information such as:

    • The URI/URL scheme of https
    • What the "secure port number" is for this Server instance.
    • The HttpServletRequest.isSecure() flag returns true
    • Any SNI certificate information is properly identified for HttpServletRequest.getServerName() (the Host request header and VirtualHost layers)
    • The javax.servlet.request.ssl_session_id Request attribute (type String, since Servlet Spec 3.0)
    • The javax.servlet.request.cipher_suite Request attribute (type String)
    • The javax.servlet.request.key_size Request attribute (type Integer)
    • The javax.servlet.request.X509Certificate Request attribute (type java.security.cert.X509Certificate[]). This is an array of objects of type X509Certificate, the order of this array is defined as being in ascending order of trust. The first certificate in the chain is the one set by the client, the next is the one used to authenticate the first, and so on.