Hi guys,
I know the feedback in this thread is a little old. The problem was put on hold while we were getting a new load balancer/WAF.
We now have full control over the forwarded headers, so we continued investigating. Unfortunately, correctly forwarding X-Forwarded-Proto did not solve the problem.
Our architecture is:
Client HTTPS → FortiWeb → HTTP → IIS :80 → ASP.NET Core
The important observation is that the Location header is already HTTP inside the ASP.NET Core application, so FortiWeb is not changing the scheme in the response.
X-Forwarded-Proto=https is correctly processed by ASP.NET Core and results in Request.Scheme=https.
We also changed URLHelper.SSLUrlPort from 0 to 443, but the behavior did not change.
A sanitized log from the problematic request:
Request.Scheme: https
Request.IsHttps: True
Request.Host: <site-host>
Response.Headers.Location: http://<site-host>/testredirect
RequestContext.IsSSL=True
URLHelper.SSLUrlPort=443
CurrentSite.DomainName=<site-host>/admin
SitePresentationURL=https://<site-host>/
Server VAR:
HTTPS=off
SERVER_PORT=80
HTTP_X_FORWARDED_PROTO=https
HTTP_X_FORWARDED_HOST=
UseForwardedHeaders() is the first relevant middleware in the pipeline.
The Former URL entry exists correctly in CMS_PageFormerUrlPath, and the target URL itself works correctly.
So at this point we have:
- Request.Scheme = https
- Request.IsHttps = true
- X-Forwarded-Proto = https
- RequestContext.IsSSL = true
- URLHelper.SSLUrlPort = 443
- Presentation URL is HTTPS
but Kentico's Former URL handling still generates:
Location: http://<site-host>/testredirect
My suspicion is therefore that the HTTP URL is being generated by the Kentico 13 Former URL redirect handling in the ASP.NET Core integration.
Does anyone have a clue what else I could investigate, or which Kentico component/method is responsible for generating the Former URL redirect?
Thanks!
Tomek