0

So I have a website configured with these bindings (fictional domains / ip addresses here):

http sub.domain.com   port 80    ip 1.2.3.4
http www.somedomain.com port 80  ip 2.2.3.3

Everything works fine, both domains work with the website, however if I add a new https binding to ONE of the domains:

https www.somedomain.com  port 443  ip 2.2.3.3

That messes up the sub.domain.com website. When I go to that website in a browser: http://www.somedomain.com it keeps redirecting to https://www.somedomain.com even though I don't want that one to run on https, I want it on http. If I remove the https binding for the other domain it all works fine again.

Can anyone suggest how I can get round it?

It is IIS 10 on Windows Server 2016 Standard

Paul
  • 113
  • 2
  • A bit of extra info, when I look at what is happening in Postman, the response is 307 temporary redirect to https://sub.domain.com – Paul Nov 01 '22 at 21:45
  • Is the option "SNI" checked at the binding option dialog? – bjoster Nov 15 '22 at 16:42

1 Answers1

0

Well it turns out the problem was I had this line of code in my asp.net core web app in Program.cs

app.UseHttpsRedirection();

When I commented that out i'm not getting the undesired redirecting anymore.

I was surprised though that that line of code acts differently depending on some IIS bindings settings, because it only redirects to https depending on the bindings and not always.

Paul
  • 113
  • 2
  • The 307 response is a good indicator that this issue was caused by the web app itself. Most IIS triggered redirection by default generates 301 responses. Tools like Failed Request Tracing are often used to identify the cause of redirection, and they can help locate the culprit sooner. – Lex Li Nov 02 '22 at 05:00