0

I have an existing portal running on HTTP, some pages run on HTTPS, both currently work fine. We now want it to only work on HTTPS and redirect any HTTP traffic over to HTTPS URLs as a 301 redirect.

I have tried a redirect in the global.asax, rewrite rules in the web.config and adding [RequireHttps] to the controller from which all our MVC controllers inherrit but although all of the above solutions work in my Azure emulator, when I deploy it to Azure, it does not respond on HTTP any more. It works fine on HTTPS if you go there directly though. Telnet to port 80 still works so the server is still responding on port 80 but something is going wrong.

So basically the redirects don't work, the server does not respond correctly on port 80(HTTP), and the server only responds properly on HTTPS now. If I remove the permanent redirect code, then my portal starts responding on normal HTTP again.

When I run a request to the home page via fiddler, this is the response:

HTTP/1.1 504 Fiddler - Receive Failure Date: Mon, 19 Dec 2016 13:02:33 GMT Content-Type: text/html; charset=UTF-8 Connection: close Cache-Control: no-cache, must-revalidate Timestamp: 15:02:33.371

[Fiddler] ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.

How can I get it to still respond on HTTP in Azure but with a redirect?

Richard Mannion
  • 289
  • 5
  • 17
  • Possible duplicate of [How to force HTTPS using a web.config file](http://stackoverflow.com/questions/9823010/how-to-force-https-using-a-web-config-file) – EvertonMc Dec 19 '16 at 22:05
  • Hi EvertonMc, that post is not relevant because I have already tried that solution and that caused the above problem as well. – Richard Mannion Dec 20 '16 at 04:18

0 Answers0