{"action":"created","issue":{"url":"https://api.github.com/repos/ThreeMammals/Ocelot/issues/431","repository_url":"https://api.github.com/repos/ThreeMammals/Ocelot","labels_url":"https://api.github.com/repos/ThreeMammals/Ocelot/issues/431/labels{/name}","comments_url":"https://api.github.com/repos/ThreeMammals/Ocelot/issues/431/comments","events_url":"https://api.github.com/repos/ThreeMammals/Ocelot/issues/431/events","html_url":"https://github.com/ThreeMammals/Ocelot/issues/431","id":335317118,"node_id":"MDU6SXNzdWUzMzUzMTcxMTg=","number":431,"title":"Should I be able to reRoute to a rest controller rather than a service?","user":{"login":"wayne-o","id":178060,"node_id":"MDQ6VXNlcjE3ODA2MA==","avatar_url":"https://avatars0.githubusercontent.com/u/178060?v=4","gravatar_id":"","url":"https://api.github.com/users/wayne-o","html_url":"https://github.com/wayne-o","followers_url":"https://api.github.com/users/wayne-o/followers","following_url":"https://api.github.com/users/wayne-o/following{/other_user}","gists_url":"https://api.github.com/users/wayne-o/gists{/gist_id}","starred_url":"https://api.github.com/users/wayne-o/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wayne-o/subscriptions","organizations_url":"https://api.github.com/users/wayne-o/orgs","repos_url":"https://api.github.com/users/wayne-o/repos","events_url":"https://api.github.com/users/wayne-o/events{/privacy}","received_events_url":"https://api.github.com/users/wayne-o/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-25T08:58:14Z","updated_at":"2018-06-25T17:23:02Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"## Expected Behavior / New Feature\r\n\r\nWhen I configure ocelot to resolve something like \r\n\r\n```\r\n\"DownstreamPathTemplate\": \"/api/v1/permissions/{everything}\"\r\n\"DownstreamHostAndPorts\": [\r\n            {\r\n                \"Host\": \"service.permissions\",\r\n                \"Port\": 80,\r\n            }\r\n ],\r\n\"UpstreamPathTemplate\": \"/api/v1/permissions/{everything}\"\r\n```\r\n\r\nIt should be able to map to http://service.permissions/api/v1/permissions/\r\n\r\n## Actual Behavior / Motivation for New Feautre\r\n\r\n404\r\n\r\nNote: \r\n - when I navigate to  http://service.permissions/api/v1/permissions/ it works\r\n - when using this config it works (Ocelot is able to re-route my request correctly):\r\n```\r\n\"DownstreamPathTemplate\": \"/api/v1/{everything}\"\r\n\"DownstreamHostAndPorts\": [\r\n            {\r\n                \"Host\": \"service.permissions\",\r\n                \"Port\": 80,\r\n            }\r\n ],\r\n\"UpstreamPathTemplate\": \"/api/v1/{everything}\"\r\n```\r\nThe reason this is an issue for me is that I have a service with 3 controllers:\r\n\r\n-  1 of the controllers requires auth on all POST/GET/DELETE etc \r\n- 1 of the controllers has mixed: no auth on GET, auth on POST/DELETE/PUT\r\n- 1 of the controllers has no auth at all\r\n\r\nSo I would like to be able toc onfigure re-routes on a per controller bases - my controllers are restful so GET /permissions/ maps to PermissionsController.Get - if that matters\r\n\r\nI wonder if the RegEx requires a trailing `/`? as that would not be present on a query like:\r\n\r\n http://service.permissions/api/v1/permissions?filter[name]=test\r\n\r\n## Steps to Reproduce the Problem\r\n\r\n  1.\r\n  1.\r\n  1.\r\n\r\n## Specifications\r\n\r\n  - Version:\r\n  - Platform:\r\n  - Subsystem:\r\n"},"comment":{"url":"https://api.github.com/repos/ThreeMammals/Ocelot/issues/comments/400030040","html_url":"https://github.com/ThreeMammals/Ocelot/issues/431#issuecomment-400030040","issue_url":"https://api.github.com/repos/ThreeMammals/Ocelot/issues/431","id":400030040,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDAzMDA0MA==","user":{"login":"TomPallister","id":5716716,"node_id":"MDQ6VXNlcjU3MTY3MTY=","avatar_url":"https://avatars3.githubusercontent.com/u/5716716?v=4","gravatar_id":"","url":"https://api.github.com/users/TomPallister","html_url":"https://github.com/TomPallister","followers_url":"https://api.github.com/users/TomPallister/followers","following_url":"https://api.github.com/users/TomPallister/following{/other_user}","gists_url":"https://api.github.com/users/TomPallister/gists{/gist_id}","starred_url":"https://api.github.com/users/TomPallister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomPallister/subscriptions","organizations_url":"https://api.github.com/users/TomPallister/orgs","repos_url":"https://api.github.com/users/TomPallister/repos","events_url":"https://api.github.com/users/TomPallister/events{/privacy}","received_events_url":"https://api.github.com/users/TomPallister/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T17:23:02Z","updated_at":"2018-06-25T17:23:02Z","author_association":"MEMBER","body":"@wayne-o  The routes `/api/v1/permissions/{everything}` and `/api/v1/permissions/` are different which is why you get a 404. A user might want one behaviour for /permissions/ and a different behaviour for /permissions/xxx which is why Ocelot works like this.\r\n\r\nIf you set up a ReRoute with `/api/v1/permissions/` then all the requests will be routed to your controller. You can then separate out different functionality for HTTP verbs using the UpstreamHttpMethod property e.g.\r\n\r\n```json\r\n\"UpstreamHttpMethod\": [\r\n              \"Get\"\r\n          ],\r\n```\r\n\r\nHope that helps! Let me know if you are still struggling."}}
{"actor":{"display_login":"TomPallister"}}