Can redirect to HTTPS by IP address?

A certain folder on my website will be secured with SSL, so the web.config file in that folder contains the following code.   Because I can't put it in Production to test it, I test the site with the IP address.   However, I get an "error 500" when I browse to a page in that folder.  The server doesn't seem to append the "https://" to the page address, as I understand it should.  Is it because I am browsing using an IP address rather than a domain name?

I am working on getting screen captures, which I will try to post here.
Any suggestions?

<?xml version="1.0" encoding="utf-8"?>
				<remove name="Redirect to HTTP" />
				<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
					<match url="(.*)" />
						<add input="{HTTPS}" pattern="^OFF$" />
					<action type="Redirect" url="https://{ToLower:{HTTP_HOST}{REQUEST_URI}}" appendQueryString="false" redirectType="Permanent" />

Open in new window

Rob RudloffIT Development SpecialistAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad GrouxSenior Manager (Wintel Engineering)Commented:
Yes, it is because you are browsing via IP address. SSL certificates are tied to the FQDN listed within the certificate, generally under the "Issued to" byline. The exception is wildcards (ex: *, but you can't wildcard IP addresses in an SSL.
Phil PhillipsDevOps ArchitectCommented:
As Brad said, it has to do with how SSL certs are tied to Fully Qualified Domain Names. One thing you can try for testing is editing your local "hosts" file to force your computer to use the test IP for the production domain.

Here's a good guide to follow for modifying your hosts file:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rob RudloffIT Development SpecialistAuthor Commented:
Thanks Guys.

Please see my next question, in case you have seen this weird situation before:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.