nginx 프록시 뒤에 있는 내 애플리케이션의 하위 폴더에 액세스할 수 있는 솔루션이 있는 사람이 있나요?

nginx 프록시 뒤에 있는 내 애플리케이션의 하위 폴더에 액세스할 수 있는 솔루션이 있는 사람이 있나요?

IP 주소가 다른 두 개의 서버가 있습니다.

  • 내 웹앱을 제공하는 Tomcat https://app1.domain.com(centos6)
  • https://nginx.domain.comNginx는 waf (centos7) 를 통해 작동합니다 .

Nginx는 포트 443에서 실행 중이며 이를 사용하여 웹앱을 다음과 같이 역방향 프록시합니다.

location /app1/ {
    rewrite ^/app1(.*) /$1 break; 
    proxy_pass https://app1.domain.com/;
}

이런 식으로 나는 일반적으로 https://nginx.domain.com/app1/.

둘째, ROOT내 webapp 폴더에 birt-viewer 애플리케이션을 설치했습니다 ROOT/birt-viewer. 나는 일반적으로 링크를 사용할 때 birt-viewer 애플리케이션에 액세스합니다 https://app1.domain.com/birt-viewer.

그런데 평소에는 링크를 사용할 때 birt 애플리케이션에 접속하지 않습니다 https:// nginx.domain.com/app1/birt-viewer. 예를 들어 링크를 복사하면

/birt-viewer/Task.jsp?__report=Recare.rpgn&sample=my+parameter&__sessionId=2026

https://nginx.domain.com/app1최종 링크를 얻기 위해 링크 뒤에 붙여넣습니다.

https://nginx.domain.com/app1/birt-viewer/Task.jsp?__report=Recare.rpgn&sample=my+parameter&__sessionId=2026

Birt-viewer 애플리케이션에 접속했지만 쿠키, 세션 등의 설정이 손실됩니다.

nginx를 통해 내 웹앱에 액세스하려면 수동으로 수행해야 한다는 것을 이해하셨습니다. 단점은 쿠키, 세션 및 기타 매개변수가 손실된다는 것입니다. 하지만 액세스는 문제 없이 자동으로 이루어져야 합니다.

이것은 내 nginx 구성입니다.

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/;
}

           }

}

또한 nginx 뒤에 있는 내 웹앱이 있으면 일부 URL이 최신 상태가 아니며 여전히 이전 액세스 권한을 유지한다는 것을 알고 있습니다.

그래서 내 관심사는 nginx를 통해 birt-viewer 응용 프로그램에 자동으로 (수동이 아닌) 액세스하는 것입니다.https://nginx.domain.com/app1/birt-viewer

누구든지 나에게 해결책이 있습니까?

관련 정보