adamant-kite-43734
05/07/2024, 11:57 AMpowerful-librarian-10572
05/07/2024, 12:27 PMRequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Original-URL expr=%{REQUEST_SCHEME}://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{REQUEST_URI} ^/([^/]+)/(.*)$
RewriteRule ^/([^/]+)/(.*)$ http://%1/$2 [P,QSA,L]
Retirecting http://domain.com/foo/bar to http://foo/bar internally
It works-ish but caused a whole lot of issuesrough-horse-23315
05/07/2024, 12:29 PMpowerful-librarian-10572
05/07/2024, 12:58 PMapiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
name: app-ingress
annotations:
<http://nginx.ingress.kubernetes.io/rewrite-target|nginx.ingress.kubernetes.io/rewrite-target>: /$2
<http://nginx.ingress.kubernetes.io/use-regex|nginx.ingress.kubernetes.io/use-regex>: "true"
spec:
rules:
- http:
paths:
- path: /([^/]+)/(.+)
pathType: Prefix
backend:
service:
name: $1
port:
number: 80
powerful-librarian-10572
05/07/2024, 12:59 PMrough-horse-23315
05/07/2024, 1:04 PMpowerful-librarian-10572
05/07/2024, 1:04 PMrough-horse-23315
05/07/2024, 1:04 PMpowerful-librarian-10572
05/07/2024, 1:04 PMpowerful-librarian-10572
05/07/2024, 1:07 PMpowerful-librarian-10572
05/07/2024, 1:08 PM<http://mysite.com/app1/geo|mysite.com/app1/geo>
, the request will be internally redirected to <http://app1/geo>
within the Kubernetes cluster, but the URL in the browser will still display <http://mysite.com/app1/geo|mysite.com/app1/geo>
. This is achieved through the use of the Nginx rewrite rules which modify the path that is sent to the backend service without changing the path shown in the browser's address bar."powerful-librarian-10572
05/07/2024, 1:08 PM