proxy_pass 使用時に Nginx が 301 を送信する

proxy_pass 使用時に Nginx が 301 を送信する

AWSでホストされているウェブサイトがあります。参考文献Wixでブログmyblog.wixsite.com/blogを作成しました。今、myblog.wixsite.com/blogのコンテンツをブログそこで、次の Nginx conf を使用してこれを実現しようとしました。

location /blog/ {
          sub_filter 'http://myblog.wixsite.com/' 'https://$http_host/blog/';
          sub_filter 'https://myblog.wixsite.com/' 'https://$http_host/blog/';
          sub_filter 'href="/posts/' 'href="/blog/';
          sub_filter 'href="/category/' 'href="/blog/category/';
          sub_filter 'href="/authors/' 'href="/blog/authors/';
          sub_filter 'href="/recent/' 'href="/blog/recent/';

          proxy_ssl_verify off;
          proxy_set_header Host "myblog.wixsite.com";
          proxy_set_header X-Forwarded-Host "";
          proxy_set_header X-Forwarded-For "";
          proxy_set_header Accept-Encoding "";
          proxy_set_header Cookie "";

          proxy_pass http://myblog.wixsite.com/blog/;

          proxy_redirect ~^(http://[^/]+)(/.+)$ https://$http_host$2;
        }

さて、私が打ったときブログ、Nginxは私をhttps://myblog.wixsite.com/blog/コンテンツを表示する代わりにブログproxy_pass http://myblog.wixsite.com/blog/;自体。に 変更することも試みました proxy_pass https://myblog.wixsite.com/blog/; が、次のエラーが発生し始めました。

*532 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: <redacted>, server: www.example.com, request: "GET /blog/ HTTP/2.0", upstream: "https://myblog.wixsite.com/blog/", host: "www.example.com"

数日間試してみましたが、結果が出ませんでした。何が間違っているのか、誰か教えてもらえませんか?

答え1

どちらかを使用するproxy_redirectまたは変更

proxy_pass http://myblog.wixsite.com/blog/; to 
proxy_pass https://myblog.wixsite.com/blog/;

プロトコルがhttpsではなく であることに注意してくださいhttp。いずれにしても、wix ブログは HTTPS で提供されます。

答え2

リダイレクトを送信するのは nginx ではなく、Web サイトですhttps://myblog.wixsite.com/blog/。nginx はサイトから取得した応答をプロキシするだけです。

関連情報