-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adding support forward all headrs from downstream to upstream #6151
Comments
Hi @alzaicko thanks for reporting! Be sure to check out the docs and the Contributing Guidelines while you wait for a human to take a look at this 🙂 Cheers! |
Hi @alzaicko. Yes this is possible. I deployed a simple VirtualServer, similar to the example in here. The main difference is using apiVersion: k8s.nginx.org/v1
kind: VirtualServer
metadata:
name: cafe
spec:
host: cafe.example.com
tls:
secret: cafe-secret
upstreams:
- name: coffee
service: coffee-svc
port: 80
routes:
- path: /coffee
action:
proxy:
upstream: coffee
requestHeaders:
set:
- name: X-Forwarded-Host
value: example2.com In the deployment that the coffee-svc references, I deployed the image When I curl {
"path": "/coffee",
"headers": {
"connection": "close",
"x-real-ip": "10.244.0.1",
"x-forwarded-for": "10.244.0.1",
"x-forwarded-port": "80",
"x-forwarded-proto": "http",
"x-forwarded-host": "example2.com",
"host": "cafe.example.com",
"user-agent": "curl/8.6.0",
"accept": "*/*"
},
"method": "GET",
"body": "",
"fresh": false,
"hostname": "example2.com",
"ip": "10.244.0.1",
"ips": [
"10.244.0.1"
],
"protocol": "http",
"query": {},
"subdomains": [],
"xhr": false,
"os": {
"hostname": "coffee-c96565fcd-rr8vp"
},
"connection": {}
} Here you can see Edit: |
Is your feature request related to a problem? Please describe.
I need to pass custom values in the Host header to upstream, at the moment I can’t override the Host header in any way.
Describe the solution you'd like
Make settings in the configuration so that for the Host header, which will be sent to upstream, the value will be taken from the transmitted X-Forwarded-Host header
Describe alternatives you've considered
For example, how it is implemented here:
use-forwarded-headers - https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/configmap/#use-forwarded-headers
If true, NGINX passes the incoming X-Forwarded-* headers to upstreams. Use this option when NGINX is behind another L7 proxy / load balancer that is setting these headers.
If false, NGINX ignores incoming X-Forwarded-* headers, filling them with the request information it sees. Use this option if NGINX is exposed directly to the internet, or it's behind a L3/packet-based load balancer that doesn't alter the source IP in the packets.
The text was updated successfully, but these errors were encountered: