【问题标题】:Parameter modification in a url with a proxy_pass使用 proxy_pass 修改 url 中的参数
【发布时间】:2018-09-14 06:44:33
【问题描述】:

我有一个这样的网址: http://test1.com/_a/client/#/room/!zzz:test2.com

我想用这样的 IP 地址和端口替换这个参数 test2.com

http://test1.com/_a/client/#/room/!zzz:192.x.x.x:80

我怎样才能用 nginx 做到这一点? 这是我所做的:

location /_a/client/#/room/ {
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_pass http://127.0.0.1/_a/client/#/room/!zzz:192.x.x.x:80;
}

但它不起作用。

【问题讨论】:

  • 您不能在 nginx 中执行此操作。片段(从# 开始的URL 的一部分)永远不会发送到nginx 服务器。

标签: nginx proxy lua proxypass


【解决方案1】:

任何网络服务器或代理都不会在 URL 中看到 # 或其后面的任何内容,因为浏览器不会发送 URL 的这一部分,这称为 片段

这些只能由浏览器访问。它们不会发送到服务器,因此无法在那里修改它们。

【讨论】:

    猜你喜欢
    • 2013-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-29
    • 2021-08-08
    • 2019-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多