{"action":"closed","issue":{"url":"https://api.github.com/repos/Azure/service-fabric-issues/issues/1339","repository_url":"https://api.github.com/repos/Azure/service-fabric-issues","labels_url":"https://api.github.com/repos/Azure/service-fabric-issues/issues/1339/labels{/name}","comments_url":"https://api.github.com/repos/Azure/service-fabric-issues/issues/1339/comments","events_url":"https://api.github.com/repos/Azure/service-fabric-issues/issues/1339/events","html_url":"https://github.com/Azure/service-fabric-issues/issues/1339","id":375765849,"node_id":"MDU6SXNzdWUzNzU3NjU4NDk=","number":1339,"title":"What is the correct way to run multiple microservices on one port","user":{"login":"MikeChristensen","id":6528426,"node_id":"MDQ6VXNlcjY1Mjg0MjY=","avatar_url":"https://avatars3.githubusercontent.com/u/6528426?v=4","gravatar_id":"","url":"https://api.github.com/users/MikeChristensen","html_url":"https://github.com/MikeChristensen","followers_url":"https://api.github.com/users/MikeChristensen/followers","following_url":"https://api.github.com/users/MikeChristensen/following{/other_user}","gists_url":"https://api.github.com/users/MikeChristensen/gists{/gist_id}","starred_url":"https://api.github.com/users/MikeChristensen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MikeChristensen/subscriptions","organizations_url":"https://api.github.com/users/MikeChristensen/orgs","repos_url":"https://api.github.com/users/MikeChristensen/repos","events_url":"https://api.github.com/users/MikeChristensen/events{/privacy}","received_events_url":"https://api.github.com/users/MikeChristensen/received_events","type":"User","site_admin":false},"labels":[{"id":365329777,"node_id":"MDU6TGFiZWwzNjUzMjk3Nzc=","url":"https://api.github.com/repos/Azure/service-fabric-issues/labels/question","name":"question","color":"cc317c","default":true}],"state":"closed","locked":false,"assignee":{"login":"masnider","id":10968331,"node_id":"MDQ6VXNlcjEwOTY4MzMx","avatar_url":"https://avatars1.githubusercontent.com/u/10968331?v=4","gravatar_id":"","url":"https://api.github.com/users/masnider","html_url":"https://github.com/masnider","followers_url":"https://api.github.com/users/masnider/followers","following_url":"https://api.github.com/users/masnider/following{/other_user}","gists_url":"https://api.github.com/users/masnider/gists{/gist_id}","starred_url":"https://api.github.com/users/masnider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masnider/subscriptions","organizations_url":"https://api.github.com/users/masnider/orgs","repos_url":"https://api.github.com/users/masnider/repos","events_url":"https://api.github.com/users/masnider/events{/privacy}","received_events_url":"https://api.github.com/users/masnider/received_events","type":"User","site_admin":false},"assignees":[{"login":"masnider","id":10968331,"node_id":"MDQ6VXNlcjEwOTY4MzMx","avatar_url":"https://avatars1.githubusercontent.com/u/10968331?v=4","gravatar_id":"","url":"https://api.github.com/users/masnider","html_url":"https://github.com/masnider","followers_url":"https://api.github.com/users/masnider/followers","following_url":"https://api.github.com/users/masnider/following{/other_user}","gists_url":"https://api.github.com/users/masnider/gists{/gist_id}","starred_url":"https://api.github.com/users/masnider/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/masnider/subscriptions","organizations_url":"https://api.github.com/users/masnider/orgs","repos_url":"https://api.github.com/users/masnider/repos","events_url":"https://api.github.com/users/masnider/events{/privacy}","received_events_url":"https://api.github.com/users/masnider/received_events","type":"User","site_admin":false}],"milestone":null,"comments":4,"created_at":"2018-10-31T01:57:25Z","updated_at":"2019-10-23T22:50:35Z","closed_at":"2019-10-23T22:50:35Z","author_association":"NONE","body":"We’d like to run multiple microservices in a single Service Fabric cluster.  We don’t want to have a separate port (or IP address) for each microservice, so we’re looking for a way to have Service Fabric route the caller to the correct service based on the URL.  For example:\r\n\r\nhttps://mydomain.com/api/ ---> Routes to an “api” service running in some Docker container\r\nhttps://mydomain.com/service-information/ ---> Routes to a “service-information” service running in some other Docker container\r\n\r\nAll of these endpoints would listen on port 80, but the URL would figure out the correct service within the application to handle the call.  Seems fairly straight forward.\r\n\r\nMy first attempt was to use the “PathSuffix” attribute on the Resources/Endpoints/Endpoint node in the ServiceManifest.xml file.  I was under the impression that the service fabric load balancer or proxy would use this path to route my request.  However, after playing around with it quite a bit, the setting seems to make no difference.  Whatever service is listening on port 80 will answer the request, and if I had two services running on port 80 (even with different PathSuffixes), I’d sometimes get deployments errors if they both got put on the same node (only one thing can bind to port 80).\r\n\r\nThen, digging into this even more, I discovered a feature called “reverse proxy” which seems to do what I want.  Almost.  Once enabled (and exposed by the firewall), I can reference http://mydomain.com:19081/MyWebsite/Information, which will route to an app called MyWebsite and a Service called Information.  This is apparently the preferred method for locating a service within a cluster without exposing all the various ports your services might be using.  In other words, the Information service might be listening on port 85 but the reverse proxy will proxy that call over.  With this setup, as far as I can tell, the PathSuffix attribute is completely ignored.\r\n\r\nSo, I have a few questions:\r\n\r\n1) What’s the actual purpose of PathSuffix and in what case would I use it?  Does it actually have anything to do with the reverse proxy?\r\n2) Is there a better way to do what I’m trying to do?  I believe if we wanted to use the reverse proxy, we’d have to have one public IP address listening on port 80 that NATs to the reverse proxy port which handles all the various microservices, and another public IP listening on port 80 that goes right to the website.\r\n3) Ideally, I want URLs to work the way described up above.  I don’t want to fully qualify the app name, and I want to control exactly what services are exposed and what their path suffix is.  Is there a way to do this?\r\n\r\nThanks!!\r\n"}}
{"actor":{"display_login":"masnider"}}