-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
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
rewrite #109
Comments
https://github.com/kubernetes/ingress-gce/blob/master/docs/annotations.md#url-related Unfortunately, it seems that |
No updates on this? |
This is an upstream request to GCP load balancing: https://cloud.google.com/support/docs/issue-trackers |
Are there any updates on this? I cannot find anything related to it in the issue tracker. |
We most likely can't support this until the GCLB supports this. I would recommend looking at the open public issues and voting for rewriting for L7 load balancing: |
Thank you for the quick response! Shame it's blocked though. Maybe time to wrestle with the Nginx ingress then. |
Are there any updates for this feature? It's a basic ingress' feature and we'd like to have one. |
The alpha API shows an alternative to "service" in "routeAction" which has a "urlRewrite" attribute.
So I guess it's coming? Someday? |
Talk about limitations........ |
I wanna using HTTP Load balancer, but since the GKE not supported it yet. https://stackoverflow.com/questions/45868569/gke-ingress-not-respecting-rewrite-rule kubernetes/ingress-gce#109
Wow, spent 4 hours debugging and turns out it's just not supported 🤣 |
I can't believe that this is not supported. |
This should really be supported in GKE.. |
+1 Would love to see this supported |
+1 I would like to see as well. |
+1 |
1 similar comment
+1 |
This is such a basic feature, it literally makes ingress with path matching unusable in almost 99% of the use cases. It is so frustrating to see such basic issues being open for 1 1/2 years and apparently no one from Google side gives a single ... The experience with Google Cloud is as always (and so frustrating and annoying, it's like Microsoft under Ballmer): Yeah talk to this team. Oh we can't do anything, please talk to this team. Ah yeah please create an issue in this tracker. Oh yeah well we still don't care enough to fix it. Infuriating. By the way, the annotation docs have disappeared too and maybe I'm blind but I tried to find a list of supported annotations by this Ingress for over an hour without luck. ps: Thanks for letting me vent. |
Eventually ended up putting a nginx back-end in front of the back-end services I did need to target to do the HTTP -> HTTPS redirect, not ideal tho. I really hope Google will get this feature in place. |
WTF. Ridiculous... |
Hey folks, let's keep it professional, please. I don't disagree that this seems like a great feature, but the simple fact is that it isn't available yet. |
I think the real fact is that it is a great and one of the most essential features which Google have opened tickets as long as one and half years for. But - yes. Let's be professional. Don't be like GKE ingress. |
Amazing Google, no simple features inside Ingress:
|
Is there any alternative/workaround/progress on this? |
Hey @masus04! At a project I am working on, we migrated from one domain to a new domain. We wanted to redirect all users using the old domain to the new domain. We successfully deployed a workaround for this scenario which goes like this: the GCP Ingress does not allow rewrites/redirects; however, it allows to "route requests to different backend services depending on the URL path" (see https://cloud.google.com/kubernetes-engine/docs/concepts/ingress#multiple_backend_services). See the following k8s resource definitions. Ingress:apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: main-ingress
spec:
defaultBackend:
service:
name: nginx-redirect-service
port:
number: 80
rules:
- host: my-domain.com
http:
paths:
- backend:
service:
name: my-domain-service
port:
number: 80
pathType: ImplementationSpecific nginx Service:apiVersion: v1
kind: Service
metadata:
annotations:
cloud.google.com/backend-config: '{ "ports": { "80": "nginx-redirect-service-backendconfig" } }'
cloud.google.com/neg: '{ "ingress": true }'
name: nginx-redirect-service
spec:
ports:
- port: 80
protocol: TCP
targetPort: 80
selector:
app: nginx-redirect-deployment
type: ClusterIP
nginx BackendConfig (to configure health check):apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
name: nginx-redirect-service-backendconfig
spec:
healthCheck:
checkIntervalSec: 15
port: 80
requestPath: /nginx-redirect-health
type: HTTP nginx configuration (as ConfigMap):apiVersion: v1
data:
nginx.conf: |
user nginx;
worker_processes 1;
events {
worker_connections 10240;
}
http {
server {
listen 80 default_server;
listen [::]:80 default_server;
location / {
return 301 https://my-domain.com$request_uri;
}
location = /nginx-redirect-health {
return 200 'health OK';
add_header Content-Type text/plain;
}
}
}
kind: ConfigMap
metadata:
name: nginx-redirect-configmap nginx Deployment:apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx-redirect-deployment
name: nginx-redirect-deployment
spec:
replicas: 1
selector:
matchLabels:
app: nginx-redirect-deployment
template:
metadata:
labels:
app: nginx-redirect-deployment
spec:
containers:
- image: nginx
name: nginx-redirect-deployment
ports:
- containerPort: 80
volumeMounts:
- mountPath: /etc/nginx/nginx.conf
name: nginx-conf
readOnly: true
subPath: nginx.conf
volumes:
- configMap:
items:
- key: nginx.conf
path: nginx.conf
name: nginx-redirect-configmap
name: nginx-conf
|
Thx @pkerschbaum I'll consider it 👍 |
The Gateway API natively allows specifying rewrites. We will look into supporting this through the Gateway API. |
What API is this exactly and is there an issue we can follow the progress on? |
The Gateway API is a newer Kubernetes API meant to replace Ingress. Please look to the GKE Gateway Docs for more information about the GKE implementation. |
shakes head it took four years to not implement this basic feature and we're expected to believe that the yet-more-complicated Gateway API will be fit for use? |
Having switched from Ingress to Gateway primarily because of this issue I think the Gateway API is definitely an improvement and the separation of HttpRoutes simplify the setup. However, while the URL rewrite is part of the API specification, it appears the GCP implementation of it does not yet support the rewrite functionality. |
/reopen |
@pewpewp3w: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@therealsamlin: You can't reopen an issue/PR unless you authored it or you are a collaborator. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@swetharepakula can you please re-open once again? The issue is (still, after 4.5 years) valid. |
It's a shame that such basic functionality is not supported. Please reopen |
There is (seemingly) related item in Google's issue tracker that I think they use to prioritize stuff: https://issuetracker.google.com/issues/194125076. Please vote on it, may help getting this finally implemented. |
Lol |
This is a joke! |
May help some of you, as I struggle(d) with this for a long time, too: I don't think Kubernetes/Google team is ever going to implement it, given it's been so long - and I agree this is a joke. But! While it's not necessarily in a state (yet) that some consider production-ready, there already is a successor for the Ingress resource based routing, that is Gateway API:
Given how Ingress implementations deviate based on providers and what amazing things Gateways can achieve, I have tried using Gateway-based approach in GKE and, probably because supporting rewrite is kind of necessary to implement it at all, it works. Have it a go! |
Sitting here sipping coffee reading these comments after 5 years of getting notifications from this thread 😂 |
Rather sad news, but it looks like as of now, rewrites are not supported even as part of Gateway API (https://gateway-api.sigs.k8s.io/guides/http-redirect-rewrite/#rewrites). Following: - filters:
- type: URLRewrite
urlRewrite:
path:
type: ReplacePrefixMatch
replacePrefixMatch: / results in:
Available filters are basically ones listed here. |
Gateway API now support URL rewrites: https://cloud.google.com/kubernetes-engine/docs/how-to/deploying-gateways#configure_url_rewrites |
@swetharepakula This doesn't work. Error: no matches for kind "HTTPRoute" in version "gateway.networking.k8s.io/v1beta1" (same error message with gateway.networking.k8s.io/v1). Any idea why? Have things changed or been moved around? |
@ezeamara Please follow https://cloud.google.com/kubernetes-engine/docs/how-to/deploying-gateways#enable-gateway to ensure that the Gateway CRDs are installed on your cluster. |
@swetharepakula Thank you, that was helpful. |
Hi, I've been struggling to set a rewrite rule for my ingress (GCP Kubernetes with a Deployment, Service NodePort and Ingress). What I'm trying to get is:
So that my server can server requests whether they start with /api/ or /www/, without a care about the subdomains.
I'm creating this issue because I have a question regarding your comment in https://github.com/kubernetes/ingress-gce#paths
I wish that was true... for me, loadbalancerip/foo would be the only queryable url, while everything else returns 404 Not Found errors. The Ingress only forward a request if it matches the path, that's it.
Anyways, if you have a suggestion regarding my problem, I'd really appreciate. Couldn't figure out how to get it working with annotations rewrite-url or app-root
The text was updated successfully, but these errors were encountered: