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

Fix apicast replace_path to use remove #1285

Merged
merged 1 commit into from
Oct 2, 2019

Conversation

guicassolato
Copy link
Contributor

@guicassolato guicassolato commented Oct 2, 2019

What this PR does / why we need it:

It changes the routing policies injected into the proxy config for the backends of a product so they use the replace_path rule with remove_first instead of with replace.

Which issue(s) this PR fixes

Porta is currently generating proxy configs for products containing backends with paths with the following attribute in the corresponding injected routing policy:

"replace_path": "{{original_request.path | replace: '/the-path', '/'}}"

This is causing apicast to route the incoming traffic, for example, from <public-domain>/the-path/actual-backend-path, to <private-domain>//actual-backend-path. The correct backend endpoint would be <private-domain>/actual-backend-path.

We should use instead in the routing policy injected for the backend:

{{original_request.path | remove_first: '/the-path' }}

Closes THREESCALE-3593

Verification steps

  1. Create a product containing at least 2 backends
  2. Generate the proxy config
  3. Confirm in the json file of the proxy config that the routing policies injected in the chain for the backends with path include a replace_path rule in the following format:
    "replace_path": "{{original_request.path | remove_first: '/the-path'}}"
    

Example of part of a real proxy config generated using this PR

Screen Shot 2019-10-02 at 3 11 23 PM

Special notes to the reviewer

Related to 3scale/APIcast#1122

@guicassolato guicassolato self-assigned this Oct 2, 2019
@guicassolato guicassolato force-pushed the fix/apiap-apicast-replace-path branch from dffe56a to e91c837 Compare October 2, 2019 10:32
@guicassolato guicassolato force-pushed the fix/apiap-apicast-replace-path branch from e91c837 to 092b1ca Compare October 2, 2019 11:17
@guicassolato guicassolato requested a review from a team October 2, 2019 13:05
@thomasmaas thomasmaas added the Priority: Blocker This PR is a blocker. Everyone should review and help to close it ASAP. label Oct 2, 2019
@thomasmaas thomasmaas merged commit 8a438df into master Oct 2, 2019
@thomasmaas thomasmaas deleted the fix/apiap-apicast-replace-path branch October 2, 2019 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIAP Priority: Blocker This PR is a blocker. Everyone should review and help to close it ASAP.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants