【问题标题】:How to get calling origin in NGINX如何在 NGINX 中获取呼叫来源
【发布时间】:2021-02-06 06:58:27
【问题描述】:

有人可以帮我们在 NGINX 标头中添加调用来源吗?

我们需要根据来源(请求发起/触发的地方)将呼叫来源列入白名单

    location /some_filter_url {
            proxy_pass http://test-domain.com;
            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_set_header X-Forwarded-Host $host;
            proxy_set_header X-Forwarded-Origin {????? What should be used $http-origin is null};
    }

变量 $http-origin 为我们提供 null 值,而 $host 提供当前/原始主机。

任何帮助将不胜感激。 TIA。

【问题讨论】:

标签: nginx nginx-reverse-proxy nginx-config


【解决方案1】:

它是$http_origin,带有下划线而不是破折号。

【讨论】:

  • 感谢 Danila Vershinin 但变量 $http_origin 产生相同的结果
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-12-30
  • 2022-11-11
  • 2014-11-08
  • 1970-01-01
  • 1970-01-01
  • 2016-10-16
相关资源
最近更新 更多