https - Does tomcat know that haproxy is a proxy server? -
i have couple of questions in regards haproxy (1.5.2) , tomcat (7.0.54). both newbie in.
in tomcat have application on login (https://my.tomcat.host:8080/access) redirect user (via 303 code) web page (http://my.tomcat.host:8080/access/sessionid=1234567). setting haproxy set frontend engine (my-frontend-https) receive https requests , send them backend (my-backend-https) - in turn sends tomcat server http requests.
this haproxy.cfg (for my.haproxy.host) looks like:
frontend my-frontend-https bind *:8443 ssl crt /my/certs/server.pem mode http option httplog default_backend my-backend-https backend my-backend-https balance roundrobin mode http option httplog option forwardfor server my-tomcat-srv my.tomcat.host:8080 check
on sending following query (https://my.haproxy.host:8443/access) found location flag being returned tomcat of form: http://my.haproxy.host:80/access/sessionid=1234567. looking @ tomcat server found had enable remoteipvalve class in server.xml , set httpsserverport 8443 (as protocolheaderhttpsvalue - may not have needed bit though since it's default). seems work , add more servers backend.
so seems have couple of questions:
- i noticed problem doesn't seem exist when frontend engine http rather https. is, location field comes how expect be. ideas of discrepancy?
- without settings in server.xml file seem tomcat knows using proxy in between web browser , tomcat. how know this? there directive being passed tomcat tells proxy or simpler that.
if want front-end/back-end engine in same haproxy.cfg file pointing same tomcat instance (i.e. lets says above load balancing across multiple servers including 1 , want entry point one) can done? i.e. haproxy have following lines in it. frontend my-frontend-https1 bind *:9443 ssl crt /my/certs/server.pem mode http option httplog default_backend my-backend-https1
backend my-backend-https1 balance roundrobin mode http option httplog option forwardfor server my-tomcat-srv my.tomcat.host:8080 check
would location field come http://my.haproxy.host:8443/access/sessionid=1234567 since defined in server.xml. thanks
harold.
Comments
Post a Comment