Search code examples
c#asp.net-corereverse-proxyazure-service-fabric

How to get Service Fabric Reverse Proxy to work on Azure


I created a Azure Service Fabric Web API and planned to reach it through Service Fabric's built in Reverse Proxy.

All was working well locally but when I published to Azure, trying to access the route through Reverse Proxy would time out.

I thought it might be my app, so I just popped open a new solution with the default template and published to my local. Everything worked fine Reverse Proxy and all. So I published to Azure and again had the same issue.

I could access the Web API on azure through the normal route (through the endpoint of the service) for example:

xxxx.east.cloudapp.azure:8080/api/values

But going through the Reverse Proxy port of 19081 times out:

xxxx.east.cloudapp.azure:19081/[app]/[service]/api/values

I did make sure to tick off Enable Reverse Proxy when setting up the cluster resource on Azure, and set the port to 19081. Both of the above works fine on localhost, but only the normal route works on Azure.

Was wondering if there's some extra editing of the manifest or something I had to do to make it work on Azure correctly?


Solution

  • Did you see the documentation on how to configure it?

    If you're going to expose services on the internet, be aware that the built-in one causes every service to become exposed, it's not hardened, it's vulnerable to DOS attacks. Docs

    I recommend having a look at Traefik as a reverse proxy and load balancer. You can run it as a (containerized) ingress routing service inside the cluster, and direct HTTP calls to your services.

    Alternatively, you can use Api Gateway, which integrates with SF too. Or even Nginx.