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
Prevent trailing slash in patterns of proxy rules of backend api configs with a path #1394
Conversation
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.
@guicassolato as this behaviour doesn't seem to be transparent we might want to ping @3scale/documentation to add a note about this in docs?
return pattern_value unless backend_api_path | ||
parts = ['/', backend_api_path] | ||
parts << pattern_value unless pattern_value == '/' | ||
File.join(*parts) |
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.
Question: is it not better to manipulate the path with the rails UrlHelper
?
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 agree with @didierofrivia , this way it seems that it is somehow related to a File, but it isn't 🤔
another alternative would be parts.join('/')
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.
Spoken with Gui. I will push this fix after lunch in another PR 👍
@guicassolato @thomasmaas You can create a JIRA and we'll add the note. |
This will make proxy rules whose pattern is the "catch-all" pattern
/
not to end with the slash if the pattern has been prepended by a backend api path.Example 1
Backend path:
/mybackend
Proxy rule pattern:
/
Actual proxy rule pattern in the config:
/mybackend
(it used to be/mybackend/
before this PR)Example 2
Backend path:
/mybackend
Proxy rule pattern:
/hello
Actual proxy rule pattern in the config:
/mybackend/hello
(same as before)Example 3
Backend path:
/
Proxy rule pattern:
/
Actual proxy rule pattern in the config:
/
(same as before)Example 4
Backend path:
/
Proxy rule pattern:
/hello
Actual proxy rule pattern in the config:
/hello
(same as before)Closes THREESCALE-3833