NGINX 重定向到 escaped_fragment URI 的根目录

NGINX redirecting to root for escaped_fragment URI

我有一个非常奇怪的情况,NGINX(用作节点应用程序的代理)在使用 https://domain.com?_escaped_fragment_=/app/someurl BUT when I use https://dev.domain.com?_escaped_fragment_=/app/someurl 时将所有 ?_escaped_fragment_= 重定向到根目录 (/) 一切正常。

只是想说明预渲染器运行良好,我已经直接在机器上以及使用 dev 子域对其进行了测试。

我可以给那些想要实时检查东西的人提供原件 URL。

感谢百万人 :)

server {
    server_name domain.com www.domain.com;
    listen 80;
    return 301  https://domain.com$request_uri;
}

server {

    server_name domain.com;

    listen 443 ssl;

    ssl_certificate     /etc/nginx/ssl/***.crt;
    ssl_certificate_key /etc/nginx/ssl/***.key;

    location / {

        proxy_pass http://x.x.x.x:4567;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

server {

    server_name dev.domain.com;

    location / {

        proxy_pass http://x.x.x.x:4567;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
}

对于那些有类似经历的人可能也使用 apache 请注意它不是 NGINX 而是你需要指定预渲染中间件的应用程序.set('protocol', 'https' ));

protocol

Option to hard-set the protocol. Useful for sites that are available on both http and https.

app.use(require('prerender-node').set('protocol', 'https'));