web/app/dbスタックを設定していますが、nginxプロキシ設定が正しく動作していません。nginxプロキシされたリダイレクトは、ホストではなくプロキシのポート番号を使用します。
ので、ここでは、スタックの例です...アプリケーションのURLは次のとおりです。
server {
listen 8886;
server_name _;
root /usr/share/nginx/html;
include /etc/nginx/default.d/*.conf;
#ELB
if ($http_user_agent = 'ELB-HealthChecker/2.0') {
return 200 working;
}
#HTTP to HTTPS
if ($http_x_forwarded_proto != 'https') {
return 301 https://$host$request_uri;
}
location/{
set $proxy_upstream_name "testapp.com";
port_in_redirect off;
proxy_pass http://internal-alb.amazonaws.com:8083/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header Access-Control-Allow-Origin $http_origin;}
アプリは内部AWS ALBにプロキシされます。ここでhttps://testapp.com
はnginxの設定ファイルでありますそれを単一の(この時点で)アプリケーションサーバーに転送します。
私はサイトを提供することができます。しかし、アプリケーションはログイン時にリダイレクトを作成し、次のような応答が返されます。
それは443に提供されていますので、リダイレクトが失敗したRequest URL:https://testapp.com/login
Request Method:POST
Status Code:302
Remote Address:34.192.444.29:443
Referrer Policy:no-referrer-when-downgrade
Response Headers
content-language:en-US
content-length:0
date:Mon, 11 Sep 2017 18:35:34 GMT
location:http://testapp.com:8083/testCode
server:openresty/1.11.2.5
status:302
、ない8083
それがリバースプロキシのことだやってリダイレクトするようにアプリやプロキシは、ポートを更新していないいくつかの理由プロキシされたポートは実際のアプリケーションポートではありません443.
正しくリダイレクトするには、nginx configをどうすればよいですか。
ありがとうございました。 myles。
で合理的に確信していますか? –
'proxy_redirect http://internal-alb.amazonaws.com:8083/ https://testapp.com;を追加してみてください。 –