Open fleed opened 5 years ago
I was able to my goal with the following fragments:
return new WebHostBuilder()
.UseKestrel()
.UseStartup<Startup>()
.UseIISIntegration()
.UseServiceFabricIntegration(
listener,
ServiceFabricIntegrationOptions.UseReverseProxyIntegration)
.UseUrls(url)
.Build();
Startup.cs [Configure (IApplicationBuilder app)
]
var headersOptions = new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.All,
ForwardLimit = null,
RequireHeaderSymmetry = false
};
headersOptions.KnownNetworks.Clear();
headersOptions.KnownProxies.Clear();
app.UseForwardedHeaders(headersOptions);
nginx config:
proxy_pass http://localhost:19081/SFApplication/WebApplication/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header Referer $http_referer;
proxy_set_header X-Forwarded-For $remote_addr;
I'm not sure if all of them are needed or there are side effects, so I'm still testing all scenarios.
I have the following setup:
Nginx -> SF Reverse Proxy -> .net core web application (hosted as stateless service)
The problem: all links in the Asp.net core application are generated using the machine name and the internal port of the service, and not with the original address. Example: Browser url: http://mywebsite.com/ Generated links: http://{machine_name}/SFApplicationType/SFService/{path_to_the_page} Expected links: http://mywebsite.com/{path_to_the_page}
Remark: if I browse to the address http://mywebsite.com/{path_to_the_page}, I can see the page (still with broken links)
My Nginx configuration:
my .net core app stateless service:
How can I get the expected links?
Thank you