DNS setup for one domain with HTTP on one IP and HTTPS on a second IP
Solution 1
I'm afraid you cannot do what you are asking directly unless you want HTTPS traffic to go to e.g. secure.example.com instead of www.example.com.
The only solution would be to put a proxy/firewall/load balancer device in front of your webservers that forwarded on traffic to the different IP addresses based on the protocol used.
Solution 2
There's no way to perform this with DNS, as you have to have one IP address for a given NAME, irrespective of the protocol the options available to you are:
- Use a firewall/router to route the traffic accordingly to different servers.
- Add a new record for, for example,
secure.example.com
as2.2.2.2
, configure the server hosting1.1.1.1
to redirect any HTTPS requests forwww.example.com
tosecure.example.com
Related videos on Youtube
![Jeff](https://i.stack.imgur.com/ukJsE.png?s=256&g=1)
Jeff
Updated on September 18, 2022Comments
-
Jeff almost 2 years
Regarding DNS records, how do I setup one domain,
www.example.com
, which has HTTP forwww
on 1.1.1.1 and HTTPS forwww
on 2.2.2.2?For clarity:
- HTTP www.example.com resolves to 1.1.1.1
- HTTPS www.example.com resolves to 2.2.2.2
Currently I have:
@ IN A 1.1.1.1 www IN A 1.1.1.1
My current (average) knowledge of DNS records is suggesting that I'm not going to be able to set it up that way. Instead I'll have to create a new a-record to something like
secure IN A 2.2.2.2
.Note: Setting HTTPS www.example.com on 1.1.1.1 is not an option, unfortunately.