I have two servers with different IP addresses:
- Tomcat serving my webapp
https://app1.domain.com
(centos6)
- Nginx acting as waf via
https://nginx.domain.com
(centos7)
Nginx is running on port 443, and I'm using it to reverse proxy my webapp this way:
location /app1/ {
rewrite ^/app1(.*) /$1 break;
proxy_pass https://app1.domain.com/;
}
This way, I normally access my webapp via nginx through https://nginx.domain.com/app1/
.
Secondly, in the ROOT
folder of my webapp, I installed the birt-viewer application in the ROOT/birt-viewer
folder. I normally access the birt-viewer application when I use the link https://app1.domain.com/birt-viewer
.
However, I don't normally access the birt application when I use the link https:// nginx.domain.com/app1/birt-viewer
. When I copy for example the link
/birt-viewer/Task.jsp?__report=Recare.rpgn&sample=my+parameter&__sessionId=2026
and I paste it after the link https://nginx.domain.com/app1
to obtain the final link
https://nginx.domain.com/app1/birt-viewer/Task.jsp?__report=Recare.rpgn&sample=my+parameter&__sessionId=2026
I access the birt-viewer application but I lose settings such as cookies and sessions.
You understand that to access my webapp via nginx I have to do it manually; the disadvantage is the loss of cookies, sessions and other parameters.
Yet access should be done automatically without problems.
This is my nginx config:
user nginxxxx;
worker_processes 1;
error_log /var/log/error.log warn;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
# include mime.types;
include /opt/nginx/conf/mime.types;
include /opt/nginx/conf/naxsi_core.rules;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/access.log main;
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
tcp_nodelay on;
gzip on;
gzip_disable "MSIE [1-6].(?!.*SV1)";
client_max_body_size 100m;
client_body_buffer_size 10K;
server {
listen 443 ssl;
server_name nginx.domain.com;
access_log on ;
access_log /var/log/access.log main;
error_log on ;
error_log /var/log/error.log warn;
ssl_certificate /etc/ssl/certs/m.crt;
ssl_certificate_key /etc/ssl/private/cs.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
add_header Strict-Transport-Security "max-age=63072000; includeSubdomains;" always;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
error_page 403 /403_error.html;
location = /403_error.html {
root /usr/share/nginx/htmml;
internal;
}
error_page 404 /404_error.html;
location = /404_error.html {
root /usr/share/nginx/html;
internal;
}
location /app1/
{
rewrite ^/app1(.*) /$1 break;
proxy_connect_timeout 60000;
proxy_send_timeout 60000;
proxy_read_timeout 60000;
send_timeout 60000;
proxy_pass https://app1.domain.com/;
}
location /app1/birt-viewer/ {
rewrite ^/app1/folder1(.*) /$1 break;
proxy_pass https:// app1.domain.com/birt-viewer/;
}
}
}
I also realize that once my webapp behind nginx, some urls are not up to date and still keep the old access.
So my concern is to access the birt-viewer application automatically (not manually) through nginx via https://nginx.domain.com/app1/birt-viewer
Does anyone have a solution for me?