Reputation: 1342
Just to preface this: I know that this is a horrible idea, but just trust me here. If I was in any other position I would avoid doing this.
I have an application built in Visual Studio that uses IIS on HTTPS port 44300. I am replacing some HTTPS
API requests with others that use HTTP
. Chrome prevents these requests with mixed content errors. I have looked at other questions that mention the same thing and all come up with hacky answers that should never be used in production.
Since there is no chance that I can get the API to switch to HTTPS
, I am looking to modify my app to run on HTTP
.
My attempt at doing this is modifying the project's properties. (Project -> Properties -> Web -> Servers).
You can see that I have the project URL set to use HTTPS
When I change that url to be http://localhost:44300
the application starts me at https://localhost/
even though that's not the config, and tells me that localhost can't be reached. No big deal, I manually change the URL to be http://localhost:44300
and it sends me back to https://localhost/
. When I leave out the port and just manually enter http://localhost
I get a 404 page.
I have also tried setting the port to 80
in the Project properties page. I just get automatically redirected to https://localhost
when I delete the S
.
The app is built using ASP.NET.
Is there some obvious issue that I'm not seeing with IIS and the port? Or is this an issue with the way that my app is built? In which case, this is a bad question.
Upvotes: 2
Views: 11554
Reputation: 1342
It ended up being an issue with the way that my app was configured.
This line was the culprit:
filters.Add(new RequireHttpsAttribute());
Upvotes: 0
Reputation: 451
Check if your Web.config includes the following lines
<httpRedirect enabled="true" destination="https://localhost" />
or
UrlRewrite configuration
<action type="Redirect" url="http://example.com/{R:1}" />
It might also have to do with HTST and Chrome in case you use Chrome. See this answer
Google Chrome redirecting localhost to https
Upvotes: 4