[GLASSFISH-18685] X-Forwarded-Proto not honored by glassfish Created: 03/May/12  Updated: 27/May/15  Resolved: 08/Jun/12

Status: Resolved
Project: glassfish
Component/s: None
Affects Version/s: 3.1.2
Fix Version/s: 3.1.1_b05

Type: Bug Priority: Major
Reporter: galabar Assignee: shreedhar_ganapathy
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


Attachments: Zip Archive patch-18685-and-18686.zip    
Issue Links:
relates to GLASSFISH-20842 X-Forwarded-Proto not honored by glas... Resolved


I am using a reverse proxy configuration in Apache with mod_proxy_http. I set the X-Forwarded-Proto header to either "http" or "https" depending on how the client accessed Apache.

Glassfish ignores this header and uses the "http" protocol specified in the Apache ProxyPass statement when building URLs (I am using Jersey and UriBuilder to create the URLs).

I was moving over from Jetty where this is supported:


Is there any way to accomplish this in Glassfish?

Comment by galabar [ 03/May/12 ]

Here are some related issues:


Comment by oleksiys [ 08/Jun/12 ]

will be fixed starting from GF 3.1.2 UR 2.

Comment by oleksiys [ 08/Jun/12 ]

patch for Glassfish 3.1.2

fixes issue 18685 + 18686

  • to specify HTTP request header name, whose value would be mapped to protocol scheme, use attribute scheme-mapping like (in the domain.xml file):

<http default-virtual-server="server" max-connections="250" scheme-mapping="X-Forwared-Proto">

  • to specify HTTP request header name, whose value would be mapped to remote-user, use attribute remote-user-mapping like (in the domain.xml file):

<http default-virtual-server="server" max-connections="250" remote-user-mapping="X-Forwarded-User">

Comment by dazed [ 27/May/15 ]

For anyone following - slight typo in the last (sorry oleksiys) - "+d" missing in "X-Forwared-Proto" to "X-Forwarded-Proto" - copy and paste caught me out

<http default-virtual-server="server" max-connections="250" scheme-mapping="X-Forwarded-Proto">

Generated at Thu May 28 18:23:16 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.