cf check-route with path should not require the slash
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
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.
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?
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.
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
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.
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.
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.
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.
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.
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