Skip to content
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

reverse proxy: support URL rewriting #88

Closed
kevinbader opened this issue Aug 9, 2018 · 0 comments
Closed

reverse proxy: support URL rewriting #88

kevinbader opened this issue Aug 9, 2018 · 0 comments
Assignees
Milestone

Comments

@kevinbader
Copy link
Contributor

kevinbader commented Aug 9, 2018

Right now, {id} can be used as a placeholder for variable parts of an URL. There are issues with the current approach:

  • The name inside the curly braces does not matter - it can't be referred to in the target URL.
  • The format is non-standard and quite inflexible.

I think that if we want to support URL rewriting we should adopt industry standards, which basically means using regular expressions. Using regular expressions is admittedly a bit more complicated than the current approach might be, but it is very efficient (expressions can be pre-compiled) and flexible.

The implementation should enable the following scenario:

Given the request URL `/books/123/chapters/456`,
and the rule `/books/([^/]+)/chapters(?<chapter_id>/?|/.*)` => `http://chapter-service:8080/v1/chapters/chapter_id`,
then the request is forwarded to `http://chapter-service:8080/v1/chapters/456`.

Proposed :re options: :no_auto_capture, :dupnames, :unicode, :anchored, :caseless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants