Mike Baxter
Mike Baxter

Reputation: 7268

Accessing local https site over LAN

I am trying to debug my ASP.Net MVC website when hosted over https. I am hosting this via the IIS instance with Visual Studio. I need to access the website from a mobile device - so I am attempting to access the site via LAN.

I have enabled https via visual studio by going to the project properties and setting SSL Enabled to true. Now, when I debug the site, it starts two local instances; one for http (as usual) and one for https. The internal ports for these are listed when I right click the IIS icon in the task tray.

I do not have an SSL certificate installed. My browser gives me insecure connection warnings, but I just dismiss them - I don't believe these are a concern as I am just testing locally (I could be wrong).

I am using a program called Sharp Proxy to translate these internal ports to external ones, allowing my site to be accessible. 64312 is my internal port for accessing the site over http. Sharp proxy is translating this to 4567. 44300 is my internal port for accessing the site over https. Sharp proxy is translating this to 5678.

Successful permutations:

http://localhost:64312 - SUCCESS
https://localhost:44300 - SUCCESS
http://192.168.0.72:4567 - SUCCESS

Failed permutations:

https://192.168.0.72:5678 - FAIL
Bad Request - Invalid Hostname

The issue is clearly not to do with accessing my machine over LAN as I am able to successfully hit 192.168.0.72 with http.

My question is: What do I need to do to be able to access my https site over LAN via debugging with Visual Studio?

Upvotes: 1

Views: 2026

Answers (1)

SLaks
SLaks

Reputation: 887529

In order to verify the identity of the server you're connecting to, HTTPS needs a hostname to check the certificate against.

Therefore, you cannot connect to an IP address over HTTPS.

You need to use a domain name.

Upvotes: 3

Related Questions