【发布时间】:2026-01-31 10:00:01
【问题描述】:
我正在尝试使用 nginx 反向代理重写自定义标头信息,例如“作者”(不是 URL 的一部分)。 标题信息“作者:”应从“test123”重写为例如“基本”
命令:
admin1@nginx1:~$curl -x 192.168.175.134:80 http://home1.MyWeb.eu:8081/home1/index.html?t=1 -H "Author: test123" -vk
Apache 上的 TCPdump:
--
GET /home1/index.html?t=1 HTTP/1.0
Host: home1.MyWeb.eu
Connection: close
User-Agent: curl/7.58.0
Accept: */*
Proxy-Connection: Keep-Alive
Author: test123
想要的结果:
--
GET /home1/index.html?t=1 HTTP/1.0
Host: home1.MyWeb.eu
Connection: close
User-Agent: curl/7.58.0
Accept: */*
Proxy-Connection: Keep-Alive
Author: BASIC
【问题讨论】:
标签: nginx url-rewriting http-headers reverse-proxy