HSTS and new server switch (hosts file)


#1

Hi All,

I’m trying to move hosting companies.

I have HSTS enabled on my https site.

Usually - I’d set up my site on the new server - and edit my windows hosts file to make my browser think site domain points to the new IP

127.0.0.1 localhost
::1 localhost
8.8.8.8 www.example.com

The problem now is - cloudflare and using HSTS - cloudlfare knows that the IP is wrong - and it wont let me access the new IP.

Is it safe to turn off HSTS - or will my users be unable to access my site?

Or can anyone give me any advice on transferring to a new server, when using cloudflare and HSTS.

Ideally - I’d like to get the site up and running on the new server - then just change the IP cloudflare loads the site from when its ready.

Using 8.8.8.8/~username/ is not an option

Thanks for the help.


#2

Normally, I transfer everything to the new server, then do the switchover during off hours to lessen user disruption. There’s a brief period where I switch IP addresses at Cloudflare, then activate my SSL Certificate, and then the site is live again.

For major work, I stage the new website as a subdomain. This way it’s functional as I get everything ready. During the migration window described above, I update all URLs before updating the IP address and issue the new cert.


#3

This topic was automatically closed after 14 days. New replies are no longer allowed.