ingress-nginx: rewrite does not work on resources
Is this a request for help? (If yes, you should use our troubleshooting guide and community support channels, see https://kubernetes.io/docs/tasks/debug-application-cluster/troubleshooting/.):
What keywords did you search in NGINX Ingress controller issues before filing this one? (If you have found any duplicates, you should instead reply there.):
Is this a BUG REPORT or FEATURE REQUEST? (choose one):
NGINX Ingress controller version: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.22.0
Kubernetes version (use kubectl version
):
Client Version: version.Info{Major:“1”, Minor:“13”, GitVersion:“v1.13.2”, GitCommit:“cff46ab41ff0bb44d8584413b598ad8360ec1def”, GitTreeState:“clean”, BuildDate:“2019-01-10T23:35:51Z”, GoVersion:“go1.11.4”, Compiler:“gc”, Platform:“linux/amd64”}
Server Version: version.Info{Major:“1”, Minor:“13”, GitVersion:“v1.13.2”, GitCommit:“cff46ab41ff0bb44d8584413b598ad8360ec1def”, GitTreeState:“clean”, BuildDate:“2019-01-10T23:28:14Z”, GoVersion:“go1.11.4”, Compiler:“gc”, Platform:“linux/amd64”}
Environment:
- Cloud provider or hardware configuration: Azure VM
- OS (e.g. from /etc/os-release): * Ubuntu16
- Kernel (e.g.
uname -a
): Linux bddev-master 4.15.0-1037-azure #39~16.04.1-Ubuntu SMP Tue Jan 15 17:20:47 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - Install tools:
- Others:
What happened: 404 error on css content its rewrites index.html fine when i hit xxxxx.westus.cloudapp.azure.com/demo but the resources are not getting reflected and i get 404 /css/site.min.css?v=SZ56l9iAMjwsC3lg_8ONpBnEfYbGculXCgb-yhj7aKs What you expected to happen: rewrite should have worked fine http 200
How to reproduce it (as minimally and precisely as possible): apiVersion: extensions/v1beta1 kind: Ingress metadata: name: simple-fanout-example annotations: nginx.ingress.kubernetes.io/rewrite-target: / spec: rules:
- host: xxxxx.westus.cloudapp.azure.com
http:
paths:
- path: /demo backend: serviceName: dotnet-service servicePort: 80
Anything else we need to know: seems like nginx.ingress.kubernetes.io/rewrite-target is not working on resources
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (2 by maintainers)
Closing. Please check https://github.com/kubernetes/ingress-nginx/releases/tag/nginx-0.22.0 You need to change the path to
/demo(.*)
and the rewrite target to/$1
IMHO, I think it is wrong to deprecate nginx.ingress.kubernetes.io/add-base-url
This is the case nginx.ingress.kubernetes.io/add-base-url can solve.
same issue
As can be seen in the image, after adding the following ingress apiVersion: extensions/v1beta1 kind: Ingress metadata: name: reactingress namespace: reactnamespace annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/rewrite-target: /$2
spec: tls:
It creates a separate folder for path given and the static folder (the relative paths) are not found hence creating the issue. Can someone please help on what can be done here?
Regards, Akshit Bhatia