im encountering an issue whereby ingress-nginx(reverse proxy) is not returning http response header (ETag) from application container.
It works fine without ingress.
Any help will be greatly appreciated.
The following is a snippet of Ingress yaml file
<!-- begin snippet: js hide: false console: true babel: false --><!-- language: lang-html -->apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ng-api-ngress
namespace: ng-prod
labels:
app: numbergenerator
annotations:
#nginx.ingress.kubernetes.io/enable-cors: "true"
nginx.ingress.kubernetes.io/cors-allow-headers: etag
nginx.ingress.kubernetes.io/cors-expose-headers: etag
#nginx.ingress.kubernetes.io/cors-allow-credentials: "true"
spec:
rules:
- host: kubernetes.docker.internal.api
http:
paths:
- pathType: Prefix
path: /
backend:
service:
name: ng-backend
port:
number: 80
<!-- end snippet -->You can add this Nginx ingress
annotation :
nginx.ingress.kubernetes.io/server-snippet: |
etag on;
nginx.ingress.kubernetes.io/configuration-snippet: |
more_set_headers "server: hide";
if Gzip is enabled Nginx ingress won't add or pass etag.
As much as i know etag wont generated by Nginx in reverse proxy configuration however if require you can generate and manage from backend code.