cli icon indicating copy to clipboard operation
cli copied to clipboard

cf check-route with path should not require the slash

Open markstgodard opened this issue 10 years ago • 10 comments

When we (Routing team) added --path support for cf check-route command we did forgot to make the "/" optional in the path, like the other commands supporting path.

For example:

$ cf routes
Getting routes as admin ...

space      host       domain          path        apps
my-space   store      bosh-lite.com   /products   products
my-space   store      bosh-lite.com   /orders     orders

$ cf check-route store bosh-lite.com --path products
Checking for route...
OK
Route store.bosh-lite.com/products does not exist

$ cf check-route store bosh-lite.com --path /products
Checking for route...
OK
Route store.bosh-lite.com/products does exist

$ cf --version
cf version 6.15.0+fa1bfe2-2016-01-13

We just need to fix it to make sure the "/" is optional in path.

cc @shalako

markstgodard avatar Jan 18 '16 20:01 markstgodard

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/111910329.

cf-gitbot avatar Jan 18 '16 20:01 cf-gitbot

This sounds like an API issue: if paths "products" and "/products" are the same, maybe the API should treat them as if they were the same?

dkoper avatar Jan 19 '16 04:01 dkoper

The API has always required a leading slash for the path field: http://apidocs.cloudfoundry.org/228/routes/creating_a_route.html

My proposal for the UX also required the leading slash. The CLI team preferred not to require this in the create-route and map-route commands, and those appear to function correctly. This is because the CLI adds the leading slash. However, the CLI isn't adding the leading slash in API calls for check-route, which results in false negatives.

shalako avatar Jan 19 '16 18:01 shalako

I noticed that the API docs for the endpoint used for check-route doesn't describe the requirement for the leading slash. http://apidocs.cloudfoundry.org/228/routes/check_a_route_exists.html

Routing team can improve the docs to look for like http://apidocs.cloudfoundry.org/228/routes/creating_a_route.html

shalako avatar Jan 19 '16 18:01 shalako

Thanks @shalako for your comments. I hadn't realized CLI was adding the slashes for the other commands. In https://www.ietf.org/rfc/rfc3986.txt the path has to start with a slash (or be empty) so it makes sense for the API to align with that. Thanks for the doc update.

dkoper avatar Jan 19 '16 23:01 dkoper

Speaking of routes, is there a way to place restrictions on creating a route with a path? Theoretically, a number of apps can 'leach' onto another apps route by just tacking on paths. If I were to use a routing proxy, I would need to explicitly add a pro pass for this to happen, but through cf create-route, I don't need to.

dglozic avatar Feb 26 '16 14:02 dglozic

hello @dglozic, there are some controls around a this. you cannot create a route from a shared domain with the same host name if a route has already been created with these attributes in another space, even if the paths differ. this prevents someone from hijacking the route myapp.cfapps.io/foo if you already have myapp.cfapps.io.

this was permitted in older releases and has been fixed in cf-release v231.

we do allow this for private domains, which allows two teams of the same organization to independently manage seperate apps with routes example.com/foo and example.com/bar

Routes can only be created for private domains by members of organizations granted access to that domain.

shalako avatar Feb 26 '16 16:02 shalako

OK, I listed my domains and see one that is shared and another marked as 'owned'. Is 'owned' the same as 'private'?

I think the private domain use case with two teams map to two paths of the same domain was the microservice use case that kind of prompted adding this feature. I wanted to use it for this use case.

dglozic avatar Feb 26 '16 16:02 dglozic

yes, owned==private

Shannon Coen Product Manager, Cloud Foundry Pivotal, Inc.

On Fri, Feb 26, 2016 at 8:40 AM, dglozic [email protected] wrote:

OK, I listed my domains and see one that is shared and another marked as 'owned'. Is 'owned' the same as 'private'?

— Reply to this email directly or view it on GitHub https://github.com/cloudfoundry/cli/issues/732#issuecomment-189363910.

shalako avatar Feb 26 '16 17:02 shalako

This bug (slash requirement) has been fixed in cf CLI v6.16.0. https://github.com/cloudfoundry/cli#downloads

Regards, Dies Koper CF CLI PM

dkoper avatar Feb 27 '16 00:02 dkoper