-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Kong can not remove or replace x-forwarded-for by Request Transformer Plugin #5989
Comments
@jagerzhang I also need to overwrite x-forwarded-for, the solution I'm using is to comment it at nginx template.
Following this thread for an elegant solution. |
You can always override |
See e.g.: #5559 (comment) |
@bungle set the |
@carnei-ro The reason of explicitly setting this header (and others) using variable is to prevent downstream client trying to forge those headers (Nginx passes them to the upstream as-is by default). By using the variable, Kong can assert full control over contents inside those header at all time. |
@bungle Thanks for your reply, I solved it with pre-function plugin. |
Great to hear that it solved the issue. We can later think should we not hardcode these or not (to use variables): But as there is a work-around already I will close this. We might need to add better docs, though. |
It's correct for x-forwarded-* headers. But x-real-ip can't removed when use this solution. How to disable the x-real-ip header on a single route so they do not get sent to the upstream. |
Summary
I try to remove or replace the x-forwarded-for Header by Request Transformer Plugin, but the header x-forwarded-for is already exsit or nothing changes when the real server received.
Steps To Reproduce
i am try remove the x-forwarded-for by Request Transformer Plugin:
![image](https://user-images.githubusercontent.com/9711651/83947448-8f641000-a849-11ea-804d-01d7d8bd3b85.png)
but it seens not work, the x-forwarded-for is already exsits:
![image](https://user-images.githubusercontent.com/9711651/83947699-3dbc8500-a84b-11ea-9feb-400b00a88db7.png)
the same result when i try replace the value of x-forwarded-for:
![image](https://user-images.githubusercontent.com/9711651/83947712-5a58bd00-a84b-11ea-80e8-1fdc514eb746.png)
4.but it works well when i add a Header:
![image](https://user-images.githubusercontent.com/9711651/83947640-d43c7680-a84a-11ea-8e6c-8a99e01f0b26.png)
So, Is Kong unable to delete x-forwarded-for?
The text was updated successfully, but these errors were encountered: