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

   > For anyone else running into this issue again with proposed rewrite rules 
not working:
   > 
   > It appears the behaviour has slightly changed with 
[#12551](https://github.com/apache/apisix/pull/12551)
   > 
   > var.var_x_forwarded_* variables are now set/overridden _after_ plugins run 
(in `set_upstream_x_forwarded_headers`), so cannot be modified anymore.
   > 
   > 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"
   > ```
   > 
   > it sets var.http_x_forwarded_port instead, which is applied to 
var.var_x_forwarded_port later on by apisix.
   
   That worked for me, thanks a lot!
   


-- 
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