URI进入proxy_pass会产生en错误(禁止使用URI)

我创建了一个nginx-config:

server {
  listen 443 ssl http2;
  listen [::]:443 ssl http2;
  server_name test.en.sitename1.ru;

  root /srv/docroot/;

  ssl_certificate         SSL_CERT;
  ssl_certificate_key     SSL_KEY;
  ssl_trusted_certificate SSL_CHAIN_CERT;

  add_header strict-transport-security "max-age=63072000; includeSubdomains; preload";

  limit_conn perip 10;

  access_log off;

  location / {
    try_files $uri @node;
  }

  location @node {
    add_header 'access-control-allow-origin' '*';
    add_header 'access-Control-Allow-Methods' 'GET,PUT,POST,DELETE,OPTIONS';
    add_header access-Control-Allow-Headers "Content-Type,Authorization,X-Requested-With";

    if ($request_method = 'OPTIONS') {
      add_header 'access-control-allow-origin' '*';
      add_header 'access-Control-Allow-Methods' 'GET,OPTIONS';
      add_header 'access-Control-Max-Age'        86400;
      add_header 'access-Control-Allow-Credentials' 'true';
      add_header 'access-Control-Allow-Headers' 'Authorization,DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
      add_header 'Content-Length' 0;
      add_header 'Content-Type' 'text/plain; charset=UTF-8';
      return 204;
    }

    proxy_redirect     off;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   Host $http_host;
    proxy_pass         http://node:3012;
  }
}

它是与Docker,nodeproxy_pass http://node:3012;)—容器的名称一起启动的。

在节点端,项目按原理/:project/:lang/<site>工作。因此,将需要以这样一种方式创建proxy_pass,使其特定的:project:lang路由到特定的server_name

houtiecong 回答:URI进入proxy_pass会产生en错误(禁止使用URI)

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3116510.html

大家都在问