使用Openresty/Nginx反向代理的受Cloudflare保护的网站

使用Openresty/Nginx反向代理的受Cloudflare保护的网站,nginx,shopify,reverse-proxy,cloudflare,openresty,Nginx,Shopify,Reverse Proxy,Cloudflare,Openresty,我想用Openresty(Nginx)为我的shopify网站构建一个反向代理,但是在我在Openresty中设置.conf文件并启动服务器之后。它显示了Cloudflare的403错误。请让我知道如何解决它。谢谢 流程: 客户端>反向代理>Cloudflare>真实站点 下面是我的配置文件 location ~ ^/ { # proxy_connect_timeout 10; # proxy_send_timeout 30; # pro

我想用Openresty(Nginx)为我的shopify网站构建一个反向代理,但是在我在Openresty中设置.conf文件并启动服务器之后。它显示了Cloudflare的403错误。请让我知道如何解决它。谢谢

流程: 客户端>反向代理>Cloudflare>真实站点

下面是我的配置文件

 location ~ ^/  {
    # proxy_connect_timeout       10;
    # proxy_send_timeout          30;
    # proxy_read_timeout          30;
    proxy_set_header Host www.myshopdomain.com;
      proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
       proxy_set_header X-Real-IP  $remote_addr;

    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Connection "upgrade";
    proxy_read_timeout 86400;
    proxy_redirect off;

 proxy_pass                  https://www.myshopdomain.com$request_uri;
# https://serverfault.com/questions/824140/nginx-log-request-and-response-api-proxy/824291
# log_format upstream_logging '[$time_local] $remote_addr - $remote_user - $server_name to: $upstream_addr: $request upstream_response_time $upstream_response_time msec $msec request_time $request_time';


}
# shopify urls
# ------------
location ~ ^/(collections|cart|products|shopify|pages|blogs|checkout|admin)/? {
    proxy_pass https://www.myshopdomain.com;
 proxy_set_header Host www.myshopdomain.com;
    client_max_body_size    10m;
    client_body_buffer_size     128k;
    proxy_connect_timeout 90;
}
这可能会奏效

proxy_pass https://nameofyourshop.myshopify.com
proxy_set_header Host nameofyourshop.myshopify.com