nginx-authenticate.conf Nginx配置 新增长链接支持代理

发布时间 2023-04-14 12:01:54作者: 彭成刚

nginx-authenticate.conf Nginx配置 新增长链接支持代理

新增代码

proxy_set_header Connection ""; 
        proxy_http_version 1.1; 
        proxy_buffering off; 
        proxy_cache off;

文件代码

server {
      listen       8888;
      server_name  localhost;

      location /aizzb-api {
        #这种方式 访问时候要用ip调用 不要用localhost 要不会显示跨域
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'POST,GET,OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'Authorization'; #跨域设置
        proxy_set_header Connection ""; 
        proxy_http_version 1.1; 
        proxy_buffering off; 
        proxy_cache off;

        proxy_pass http://192.168.40.169:59090/aizzb-api/; # PersonName
      }

      location /aaa {
        proxy_pass http://127.0.0.1:6061/aaa/;
      }

      # location /GetUserInfo {
      #   proxy_pass http://127.0.0.1:30318/GetUserInfo;
      # }
      
      #error_page  404              /404.html;

      # redirect server error pages to the static page /50x.html
      #
      error_page   500 502 503 504  /50x.html;
      location = /50x.html {
          root   html;
      }
  }