【问题标题】:How to add public url to nginx reverse proxy with a access token如何使用访问令牌将公共 url 添加到 nginx 反向代理
【发布时间】:2021-01-27 15:44:34
【问题描述】:

我正在使用公共 URL 并将其添加到我的 Nginx 反向代理。我在运行 nginx.conf 配置文件时遇到了错误的请求错误。我有一个访问令牌也需要添加

下面是我的 nginx.conf 文件。

有什么建议吗?

worker_processes  1;

events {
  worker_connections  1024;
}

http {
  server {
    listen 80;
    server_name localhost 127.0.0.1;
    client_max_body_size 0;
    set  $allowOriginSite *;
    proxy_pass_request_headers on;
    proxy_pass_header Set-Cookie;
    # External settings, do not remove


    #ENV_ACCESS_LOG
    proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
    proxy_redirect off;
    proxy_buffering off;
    proxy_set_header Host            $host;
    proxy_set_header X-Real-IP       $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_pass_header Set-Cookie;
    proxy_set_header X-Forwarded-Proto $scheme;


    location /test/ {
      proxy_pass https://a***.***.com;
    
    }

   }
}

403 ERROR
The request could not be satisfied.

【问题讨论】:

    标签: nginx web server nginx-reverse-proxy


    【解决方案1】:

    我已经通过使用 Nginx 重写模块解决了这个问题。我在下面发布了一个链接。

    http://nginx.org/en/docs/http/ngx_http_rewrite_module.html

    location /test/ {
    rewrite ^/test(.*) https://URL$1 break;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-13
      • 1970-01-01
      • 2016-07-31
      • 2021-01-17
      • 1970-01-01
      • 2021-01-11
      相关资源
      最近更新 更多