deekshith-hadil opened a new issue, #12721:
URL: https://github.com/apache/apisix/issues/12721

   ### 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:
   
   ```mermaid
   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](https://github.com/apache/apisix/issues/11974)
   - [apache/apisix/pull/8226](https://github.com/apache/apisix/pull/8226)
   - [apache/apisix/issues/9530](https://github.com/apache/apisix/issues/9530)
   - 
[apache/apisix/discussions/5091](https://github.com/apache/apisix/discussions/5091)
   - [apache/apisix/issues/11580](https://github.com/apache/apisix/issues/11580)
   
   ---
   
   **Questions:**
   
   - Is there a recommended way to have APISIX set or override 
`X-Forwarded-Host` and `X-Forwarded-Port` when 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`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl 
http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to