We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If the hostname support regex, we could use keywords extracted from hostname in rewriting rules. Like the following config:
apiVersion: extensions/v1beta1 kind: Ingress metadata: annotations: kubernetes.io/ingress.class: nginx nginx.ingress.kubernetes.io/use-regex: 'true' nginx.ingress.kubernetes.io/rewrite-target: '/repository/$repo/$1 last' nginx.ingress.kubernetes.io/proxy-body-size: 8192m name: sonatype-nexus-docker spec: rules: - host: '~^(?<repo>[^.]+)\.r\.mydomain1\.com$' http: paths: - backend: serviceName: sonatype-nexus servicePort: 8081 path: '/(.*)$' tls: - hosts: - '*~^(?<repo>[^.]+)\.r\.mydomain1\.com$' secretName: r-mydomain1-cert
Then, docker-releases.r.mydomain1.com will be used as a docker registry url.
The text was updated successfully, but these errors were encountered:
Closing. This is not supported in the Ingress Spec defined in Kubernetes.
Sorry, something went wrong.
I have found a workaround for this:
nginx.ingress.kubernetes.io/configuration-snippet: | location ~ ^/v2/ { set_by_lua_block $repo { local host = ngx.req.get_headers()["host"]; local reg = "^(?<repo>[^.]+).*"; local m = ngx.re.match(host, reg); return m['repo']; } rewrite ^/(.*)$ /repository/$repo/$1 last; }
_by_lua_block is now blocked by default for security reasons. IMO a better way to achieve this is by using server-alias:
_by_lua_block
server-alias
apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: nginx.ingress.kubernetes.io/server-alias: ~^([^.]+).my-domain.co nginx.ingress.kubernetes.io/server-snippet: set $subdomain $1; nginx.ingress.kubernetes.io/permanent-redirect: https://my-domain.co/?subdomain=$subdomain spec: ingressClassName: nginx-public rules: - host: unique-dummy-url-for-redirect-xyz123.example.com
This is not supported in the Ingress Spec defined in Kubernetes.
Nothing prevents ingress-nginx from extending that spec.
No branches or pull requests
If the hostname support regex, we could use keywords extracted from hostname in rewriting rules. Like the following config:
Then, docker-releases.r.mydomain1.com will be used as a docker registry url.
The text was updated successfully, but these errors were encountered: