-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Description
I have a scenario where APISIX acts as the primary proxy for most users. However, in certain cases, some users access our services via a second proxy, which then forwards the request to APISIX. The architecture is illustrated below:
flowchart LR
subgraph User Side
User1["User"]
User2["User (via 2nd Proxy)"]
end
subgraph Front Proxy
FrontProxy["Proxy #2"]
end
subgraph APISIX Layer
APISIX["APISIX (Proxy)"]
end
subgraph Backend
HTTPPod["HTTP Pod"]
end
User1 -- HTTP Request --> APISIX
User2 -- HTTP Request --> FrontProxy
FrontProxy -- Forwards Request --> APISIX
APISIX -- Proxies Request --> HTTPPod
Problem:
When a request comes via Proxy #2, I want APISIX to identify and set the X-Forwarded-Host and X-Forwarded-Port headers to the values from Proxy #2, rather than its own (APISIX pod) host and port.
I understand that a custom plugin could potentially achieve this, but so far, APISIX does not override X-Forwarded-Host and X-Forwarded-Port as expected—it continues to set them to APISIX's own host and port.
What I've Tried
- proxy-rewrite plugin
- serverless-pre-function plugin
- serverless-post-function plugin
I've followed the discussions and suggestions in the threads below, but none of these solutions have worked for me:
- apache/apisix/issues/11974
- apache/apisix/pull/8226
- apache/apisix/issues/9530
- apache/apisix/discussions/5091
- apache/apisix/issues/11580
Questions:
- Is there a recommended way to have APISIX set or override
X-Forwarded-HostandX-Forwarded-Portwhen requests are forwarded by another proxy? - Is this currently supported by APISIX, or is it a known limitation?
- Are there any workarounds or plugins I might have missed?
Any guidance or suggestions would be greatly appreciated!
Environment
- APISIX version (run
apisix version): 3.14.1 - Operating system (run
uname -a): ubuntu - OpenResty / Nginx version (run
openresty -Vornginx -V): NA - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info): NA - APISIX Dashboard version, if relevant: NA
- Plugin runner version, for issues related to plugin runners: NA
- LuaRocks version, for installation issues (run
luarocks --version): NA - Kubernetes environment: Server Version- v1.33.1+k3s1
Metadata
Metadata
Assignees
Labels
Type
Projects
Status