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
Ingress proposal: path rewriting #287
Conversation
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
Does rewrite need to support regex path matching? |
Should the |
This proposal should live in |
It would be helpful to provide implementation details. For example, incorporate route specific annotations, provide rewrite examples similar to the haproxy ingress controller, and highlight code changes, testing ,etc .. |
We don't support regexps for
If it's any help, here is a proof-of-concept implementation, minimally tested, based on https://haproxy-ingress.github.io/docs/configuration/keys/#rewrite-target: Miciah/router@010ce49 Let's hammer out the details of the annotation, fill out the enhancement proposal, and then build consensus around the API. |
For instance with the nginx controller adding the following annotation does | ||
the trick: | ||
|
||
`nginx.ingress.kubernetes.io/rewrite-target: /$1` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need capture? The Route
API's spec.path
value is not a regexp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @Miciah I've added a paragraph about that we don't need capture.
But it was an example with nginx annotation. I've added example for the openshift annotation and added as well an example with Traefik
feat(annotation): Provides more help on this annotation
I've opened to show implementation details/documentation, etc |
| /foo | /foo/bar | /baz | /baz/bar | | ||
| /foo | /foo/bar/ | /baz | /baz/bar | | ||
| /foo | /foo | /baz | /baz/bar | | ||
| /foo/ | /foo | / | Application is not available (Error 404) | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder about the meaning of this line; is it that the rule won't be matched due to the requested path
not being with the /
? This is my understanding.... but I would like to be sure I understand for my expectation in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's basically that the router will not redirect to the backend (so it means the user will have the 404 error from the frontend)
The 'Application is not available' page
| /foo | /foo/ | /bar | /bar/ | | ||
| /foo | /foo/bar | /baz | /baz/bar | | ||
| /foo | /foo/bar/ | /baz | /baz/bar | | ||
| /foo | /foo | /baz | /baz/bar | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this line be an output of /baz
? If I'm wrong, where does /bar
comes from?
| /foo | /foo | /bar | /bar | | ||
| /foo | /foo/ | /bar | /bar/ | | ||
| /foo | /foo/bar | /baz | /baz/bar | | ||
| /foo | /foo/bar/ | /baz | /baz/bar | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some applications deals differently when there is a trailing /
in the path at the end.
Are we saying we're going to remove the trailing /
from now on?
(BTW, I've got no ill intention, I'm just asking as I'm going to be a user, please don't hate me XD)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(It seems inconsistent with line 91)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch. I did not recopy the right stuff.
Now I will remove the content from there and link it to openshift/openshift-docs#22021
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for coming back to me :) I really appreciate.
@benoitf Really appreciate someone taking the time to do it at Red Hat :). I've been asking for this for the last 2 months. Keep up the good work :) |
fix(doc): Provides a link to the PR providing the documentation
@elafontaine thanks for your feedback I've now linked the documentation of this enhancement to a WIP Pull Request on openshift-docs repository. |
I guess this is already clear, but I'm stating it for evidence; the list in the proposal should probably be some test cases somewhere for ensuring the rewrite-path behavior. Then we could have the (Opinion alert!) I'm saying this following some massive troubleshooting with the nginx-ingress in which I've learned they've had complexify their rewrite path like you are about to do because of the path rewrite. I understand this is a really complex subject, but I believe the simpler we keep it, the better the user experience and flexibility to your users :) (Disclamer, I'm a customer) |
Hi @elafontaine I implemented using the same rules than https://haproxy-ingress.github.io/ as it may be easier for people using this annotation for the same underlying engine (haproxy) |
Just read this documentation of haproxy. I believe it would be ideal if it was straight forward :) . I was worried about the PR that seems to implement it in the router project (openshift/router#129) as it didn't seem to respect the upstream documentation; https://haproxy-ingress.github.io/docs/configuration/keys/#rewrite-target I honestly want this to be so straight forward so, thanks for instructing me :). Thanks again and let me know when it's in/want a review/want a user :). |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: l0rd The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Closing this PR as the enhancement has been implemented and merged. OCP 4.6 routes will support path rewriting. |
No description provided.