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
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