microsoft / service-fabric

Service Fabric is a distributed systems platform for packaging, deploying, and managing stateless and stateful distributed applications and containers at large scale.
https://docs.microsoft.com/en-us/azure/service-fabric/
MIT License
3.04k stars 401 forks source link

Feature Request: reverse proxy option to assume ResourceNotFound by default #877

Open qrli opened 7 years ago

qrli commented 7 years ago

With ASP.NET Core, we are using Kestrel exclusively. However, the assumption of port sharing by reverse proxy requires every microservice to add extra header X-ServiceFabric : ResourceNotFound. This is not microservice friendly, and we are caught every so often.

I propose an option/setting to switch the default behavior.

Mardoxx commented 7 years ago

Use this https://github.com/Azure/service-fabric-aspnetcore/pull/7

WebHostBuilder()
    // other config
    .UseServiceFabricIntegration(listener, ServiceFabricIntegrationOptions.UseReverseProxyIntegration)
qrli commented 7 years ago

@Mardoxx Thanks for the pointer. Great info. However, that's exactly what I want to avoid. In fact I have wrote my own middleware. (the implementation your mentioned is better than mine though :+1: ) I still have to make sure every microservice uses it correctly. And we also have Node.js microservices, which uses a different middleware.

I'd like to avoid the cross-cutting concerns to spread across all microservices. I'd like to shorten the checklist for every new microservice.

vturecek commented 7 years ago

@qrli Yup, makes sense, it's something we're working on, specifically decoupling services from each other and from networking concerns in general.

MonDeveloper commented 9 months ago

@qrli Yup, makes sense, it's something we're working on, specifically decoupling services from each other and from networking concerns in general.

No news about it? Even if I agree with @qrli and @Mardoxx the real pain here is when the Stateless Service is an existing web api application developed without the ServiceFabric SDK, I mean a java spring boot rest api or a node rest api for example. For all of them we need to find a weird way to inject a web filter to intercept all the returning response and adding the "X-ServiceFabric" "ResourceNotFound" response header before commit the original response.