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

[THREESCALE-1150] Add option to use only path-based routing #1035

Merged
merged 6 commits into from
May 14, 2019

Conversation

davidor
Copy link
Contributor

@davidor davidor commented May 13, 2019

Reference: https://issues.jboss.org/browse/THREESCALE-1150

This PR adds a new env, APICAST_PATH_ROUTING_ONLY. When set to true, the gateway will use path-based routing and will not fallback to the default host-based routing, which is what happens when using APICAST_PATH_ROUTING.

@davidor davidor requested review from a team as code owners May 13, 2019 15:23
- `true` or `1` for _true_
- `false`, `0` or empty for _false_

When this parameter is set to _true_, the gateway will use path-based routing and will not fallback to the default host-based routing. The API request will be routed to the first service that has a matching mapping rule, from the list of services for which the value of the `Host` header of the request matches the _Public Base URL_.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When this parameter is set to _true_, the gateway will use path-based routing and will not fallback to the default host-based routing. The API request will be routed to the first service that has a matching mapping rule, from the list of services for which the value of the `Host` header of the request matches the _Public Base URL_.
When this parameter is set to _true_, the gateway uses path-based routing and does not fallback to the default host-based routing. The API request is routed to the first service that has a matching mapping rule, from the list of services for which the value of the `Host` header of the request matches the _Public Base URL_.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed 👍
Thanks for the review.

Copy link
Contributor

@porueesq porueesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested a change.

@davidor davidor force-pushed the option-path-routing-only branch from 23b4227 to e991c9b Compare May 13, 2019 15:50
Copy link
Contributor

@eloycoto eloycoto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok with the change, integration tests have good coverage so you can skip my comment in the unittest.

Regards

end)

it('stores nil in the context even if there is a service for the host', function()
local service = { id = '1' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A quick comment, shouldn't need to test with more than one service?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really needed. This module only cares about what the HostBasedFinder and the PathBasedFinder modules return and they just return one service. In those 2 modules we have tests with configurations that have multiple services, so I think we are covered.

@davidor davidor added this to the 3.6 milestone May 14, 2019
davidor added 6 commits May 14, 2019 16:53
While at it, removed the unnecessary checks like the ones related with
caching internals that are not related with this functionality.
Also, made the second test clearer by making sure that both services
return different error codes for the "No mapping rules matched" error.
@davidor davidor force-pushed the option-path-routing-only branch from e991c9b to 7e4e6cf Compare May 14, 2019 14:53
@davidor
Copy link
Contributor Author

davidor commented May 14, 2019

Rebased on top of master to solve conflicts in the changelog.

@davidor davidor merged commit f64716c into master May 14, 2019
@davidor davidor deleted the option-path-routing-only branch May 14, 2019 15:03
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

Successfully merging this pull request may close these issues.

3 participants