Search code examples
c#asp.netiis

Asp MVC This site cannot provide a secure connection <IP> sent an invalid response. error


I am working on asp.net MVC project in Visual Studio 2022 community version and published it on a server it works fine with the URL http://localhost:8080/myoroject locally but when a client device tries to access the project via server IP http://192...*:8080/myproject client gets This site cannot provide a secure connection <192...*> sent an invalid response. error and all CSS & Js resources respond with Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR

enter image description here I don't know why the initial HTTP request is redirected to HTTPs request enter image description here

  • I have made sure to change the project URL to HTTP and SSL Enabled to false
  • I have made sure web.config doesn't have STS configuration
  • I have made sure to query the domain and found no lists cached via chrome://net-internals/#hsts

I am expectation for the client device to access the project via an IP address of the server and get a response but currently, the system is redirecting them to HTTPs instead of the initial HTTP request


Solution

  • I finally solved the issue, it was a meta tag from the project layout <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests"> located in Views/Shared/_Layout.chtml that was forcing HTTP to HTTPs redirecting. _layout page