users@glassfish.java.net

X-Forwarded-Proto is not honored

From: Ikrom Hotamov <ikrom.hotamov_at_gmail.com>
Date: Fri, 10 May 2013 10:59:43 +0200

Hi guys,

I have a glassfish 3.1.2.2 instance running behind an AWS Elastic Load
Balancer, which terminates the SSL. I have deployed an app on glassfish
under /mycontext and there is nothing deployed on the root context path. My
application servlet handles "X-Forwarded-Proto" manually.

When I try to make a call to https://domain.com/mycontext/ everything works
as expected, however, when I try to call https://domain.com/mycontext with
no ending slash, I get a 301 and get redirected to http instead, which, my
load balancer is not listening for.

I have tried setting http.scheme-mapping to X-Forwarded-Proto:
"asadmin set
configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.scheme-mapping=X-Forwarded-Proto"
or even by manually editing the domain.xml file, doesn't help.

Any further suggestions are really appreciated!

Regards,
Ikrom