Skip to content

Instantly share code, notes, and snippets.

@sandcastle
Created August 27, 2017 02:07
Show Gist options
  • Star 24 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save sandcastle/810dee50e96a8214519ba0989f6af964 to your computer and use it in GitHub Desktop.
Save sandcastle/810dee50e96a8214519ba0989f6af964 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