Search code examples
apachetomcatcentosmod-proxy

Tomcat Apache port 80 port 8080


I have a vps that runs tomcat 8.0.23 and apache httpd server. in tomcat i have 3 projects lets call them by names below:

/firstpro
/secondpro
/thirdpro

and i have a domain name lets call it www.mydomain.com

now what i wanna do if request comes to www.mydomain.com i want to forward it to

my.vps.ip.address : 8080/firstpro

the code below is my virtualhost configuration file:

<VirtualHost *:80>
    ServerName www.mydomain.com
    ServerAlias mydomain.com
    ProxyPreserveHost On
        ProxyPass /firstpro http://localhost:8080/firstpro
        ProxyPassReverse /firstpro http://localhost:8080/firstpro
</VirtualHost>

so, problem comes when i type in browser:

if i go to this url: www.mydomain.com i dont get any cookies that automatically my server generates for that session but if i go to url: www/mydomain.com:8080/firstpro everything works fine

thanks for reading all this. and i would be glad if someone could help me to figure it out


Solution

  • You may need a ProxyPassReverseCookieDomain since you're forwarding between your domain and localhost. – Joachim Isaksson 3 hours ago