下記のようにngixのリバースプロキシを設定した場合、tomcatのApサーバのアプリが、相対パスにリダイレクトすると、ap側に返って来ないのですが、
どこがおかしいのでしょうか
nginx.conf
1http { 2 //中略 3 4 server { 5 listen 80; 6 server_name localhost; 7 8 #charset koi8-r; 9 10 access_log logs/host.access.log; 11 12 location / { 13 root html; 14 index index.html index.htm; 15 } 16 location /cp/ { 17 proxy_set_header X-Forwarded-Host $host; 18 proxy_set_header X-Forwarded-Server $host; 19 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 20 proxy_pass http://127.0.0.1:8080/ ; 21 proxy_redirect http://127.0.0.1:8080/ /; 22 23 } 24 25} 26
アクセスルート
http://{webserverのip}/cp/webajp/
とすると http://{webserverのip}/cp/webajp/dashboardへリダイレクト想定
下記 curlで確認すると
curl
1curl -v http://127.0.0.1/cp/webajp/ 2* About to connect() to 127.0.0.1 port 80 (#0) 3* Trying 127.0.0.1... 4* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0) 5> GET /cp/webajp/ HTTP/1.1 6> User-Agent: curl/7.29.0 7> Host: 127.0.0.1 8> Accept: */* 9> 10< HTTP/1.1 302 11< Server: nginx/1.10.3 12< Date: Wed, 13 Sep 2017 00:45:14 GMT 13< Content-Length: 0 14< Location: http://127.0.0.1/webajp/dashboard 15< Connection: keep-alive 16< Set-Cookie: JSESSIONID=6A9A79E01F2545896AF1B5CD0B2AC026;path=/webajp;HttpOnly 17< 18* Connection #0 to host 127.0.0.1 left intact
http://127.0.0.1/webajp/dashboard へリダイレクトされてしまう
Nginx 1.10.3
Tomcat 8.5.11
となります。

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。