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

Prevent trailing slash in patterns of proxy rules of backend api configs with a path #1394

Merged
merged 1 commit into from Nov 5, 2019

Conversation

guicassolato
Copy link
Contributor

@guicassolato guicassolato commented Nov 4, 2019

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

@guicassolato guicassolato self-assigned this Nov 4, 2019
Copy link
Member

@thomasmaas thomasmaas left a 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)
Copy link
Member

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 ?

Copy link
Contributor

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('/')

Copy link
Contributor

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 👍

@porueesq
Copy link
Contributor

porueesq commented Nov 5, 2019

@guicassolato @thomasmaas You can create a JIRA and we'll add the note.

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