I have an application gateway for which my backend settings are configured with health probes allowing status 200-499 as healthy (I've included the 4xx
series codes as some solutions have site roots which return 404 whilst have content under other paths, and some sites return a 403 automatically for an unauthorised user / I don't want those to impact the backend health status / I wanted my solution to be as generic as possible so I can reuse the same settings across a series of sites to minimise effort when onboarding new sites).
However, my backend health shows one of my sites as returning HTTP 463
status codes (so the backend is still healthy, but this response is unexpected). Further, if I navigate to the URI of the listener associated with this backend, I get stuck in a 301 redirect to/from the same site. I do have redirects configured:
- The backend redirects from
/
to/login.aspx
for an unauthenticated user. This uses relative paths, so isn't impacted by the AppGW's hostname or frontend vs backend protocol. - The AppGW has HTTP and HTTPS listeners, the HTTP rule redirects to the HTTPS listener, whilst the HTTPS rule is associated with the backend.
However, even if I remove those features, I get the same behaviour.
Other sites on the same AppGW are setup in the same way, but don't have this issue.
I have a PowerShell script for testing redirects: Get-HttpUrlRedirects. If we assume the configuration was for example.com
, the EXPECTED output of running Get-HttpUrlRedirects -Url 'http://example.com' -Verbose
would be:
VERBOSE: Redirecting to [https://example.com/] VERBOSE: Redirecting to [https://example.com/login.aspx] Url StatusCode --- ---------- http://example.com/ 301 https://example.com/ 302 https://example/login.aspx 200
Whilst the ACTUAL output is:
VERBOSE: Redirecting to [https://example.com/] VERBOSE: Redirecting to [https://example.com/] VERBOSE: Redirecting to [https://example.com/] VERBOSE: Redirecting to [https://example.com/] Url StatusCode --- ---------- http://example.com/ 301 https://example.com/ 301 VERBOSE: Redirecting to [https://example.com/] https://example.com/ 301 VERBOSE: Redirecting to [https://example.com/] https://example.com/ 301 VERBOSE: Redirecting to [https://example.com/] # etc - I hit ctrl + C to terminate when I see this loop occurring