You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "mhofer117 (via GitHub)" <gi...@apache.org> on 2026/06/03 05:06:00 UTC

Re: [I] allow proxy-rewrite plugin to rewrite x-forwarded-port request header [apisix]

mhofer117 commented on issue #4942:
URL: https://github.com/apache/apisix/issues/4942#issuecomment-4609253417

   For anyone else running into this issue again with proposed rewrite rules not working:
   
   It appears the behaviour has slightly changed with #12551 
   
   X-Forwarded-* headers are now set _after_ plugins run (in `set_upstream_x_forwarded_headers`) and use slightly differen variables.
   
   This is what worked in our k8s cluster with ingress-apisix 2.13.0:
   ```
   apiVersion: apisix.apache.org/v2
   kind: ApisixGlobalRule
   metadata:
     name: forwarded-port-correction
   spec:
     ingressClassName: apisix
     plugins:
       - name: serverless-pre-function
         enable: true
         config:
           phase: "rewrite"
           functions:
             - "return function(conf, ctx) if ctx.var.http_x_forwarded_port == \"9443\" then ctx.var.http_x_forwarded_port = \"443\" end end"
   ```


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org