Welcome! Log In Create A New Profile

Advanced

Nginx + Tomcat 6 + Subdomain jsp issues

Posted by LucianaD 
Nginx + Tomcat 6 + Subdomain jsp issues
July 21, 2014 02:46PM
Hi everyone,

I have a problem in setting up a configuration with nginx as reverse proxy using subdomains ..

I have some apps on several servers , N apps on a tomcat server, N apps on a jboss server and I want to use Nginx as reverse proxy to prevent users from write port numbers or addressess too complicated.
Eg. I have, on tomcat server , webapp1 , webapp2 and so on.. I want that users could use webapps typing webapp1.domain.com or webapp2.domain.com instead of tomcatserver.domain.com:8080/webapp1 ..
So I have a server that is used to work as Reverse Proxy (Ubuntu server 14.04 and Nginx) that, in the matter of reverse proxy is configured in that way:

upstream tomcat_server {

server tomcat.domain.com:8080;
}
server {
listen 80;
location /webapp1 {
proxy_pass http://tomcat_server;
proxy_set_header Host $host;

}
}


and it works properly.
If I configure it with subdomains , I write a thing like that:

upstream tomcat_server {

server tomcat.domain.com:8080;
}
server{
listen 80;
server_name webapp1.domain.com;

location / {

proxy_pass http://tomcat_server/webapp1/;
sub_filter /webapp1/ /;
}

}
It works partially, because if I type webapp1.domain.com I see the correct login page, but if I do login I'm "redirected" on a page that is a mix between the login page and the page I should see (I have login forms and some parts of the page that should be) , as the user isn't able to be recognized in the session.

How could I fix this ?

Thanks

Luciana



Edited 1 time(s). Last edit at 07/21/2014 02:47PM by LucianaD.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 175
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready