I'm trying to configure cache for a specific host, but getting 404. Also It seems my config was not included into final nginx.conf. This file doesn't contain it
My ingress.yaml:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: images-ingress
labels:
last_updated: "14940999355"
annotations:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/proxy-body-size: 8m
nginx.ingress.kubernetes.io/proxy-buffering: "on"
nginx.ingress.kubernetes.io/server-snippet: |
proxy_cache static-cache;
proxy_cache_valid 404 10m;
proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504;
proxy_cache_bypass $http_x_purge;
add_header X-Cache-Status $upstream_cache_status;
spec:
tls:
- hosts:
- static.qwstrs.com
secretName: letsencrypt-prod
rules:
- host: static.qwstrs.com
http:
paths:
- path: /
backend:
serviceName: imaginary
servicePort: 9000
If I remove this sample
nginx.ingress.kubernetes.io/server-snippet: |
proxy_cache static-cache;
proxy_cache_valid 404 10m;
proxy_cache_use_stale error timeout updating http_404 http_500 http_502 http_503 http_504;
proxy_cache_bypass $http_x_purge;
add_header X-Cache-Status $upstream_cache_status;
everything works but without cache
even if I have one line from snippet above It produces 404 error and doesn't work
nginx.ingress.kubernetes.io/server-snippet: |
proxy_cache static-cache;