Skip to content

Instantly share code, notes, and snippets.

@gokusenz
Forked from sandcastle/redirect-ingress.yml
Created August 7, 2018 16:57
Show Gist options
  • Save gokusenz/fe9e212c2437c3fb9ba9f17c376564ae to your computer and use it in GitHub Desktop.
Save gokusenz/fe9e212c2437c3fb9ba9f17c376564ae to your computer and use it in GitHub Desktop.
An example of a ingress redirect using kubernetes and nginx `configuration-snippet`
kind: Ingress
apiVersion: extensions/v1beta1
metadata:
name: redirect-ingress
annotations:
ingress.kubernetes.io/configuration-snippet: |
if ($host ~ ^(.+)\.somedomain\.io$) {
return 301 https://$1.domain.io$request_uri;
}
spec:
rules:
- host: "*.domain.io"
http:
paths:
- path: /
backend:
serviceName: the-app
servicePort: 8002
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment