possible to resolve DNS based on URL path

2019-02-11 03:40发布

My understanding is that there are certain advantages to putting two related sites under the same domain, as opposed to separate subdomains (for example sub-sites for different book genres). Two I can think of are using the same SSL cert, and SEO rankings.

I'd like to have different paths for the same domain resolve to different IP addresses. For example example.com/a to 100.100.100.100 and example.com/b to 200.200.200.200. I know this isn't possible with traditional DNS servers, but are there other techniques or commercial services out there that would accomplish this? Ideally I'd be also able to dynamically change where the paths resolve to as well, as different servers come on or offline.

3条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-02-11 04:32

That can't be done; DNS' name to IP resolution only considers the hostname.

You could achieve a similar result by hosting a reverse proxy like nginx atexample.com, and then direct queries for /a to 100.100.100.100 and for /b to 200.200.200.200.

查看更多
SAY GOODBYE
3楼-- · 2019-02-11 04:33

You can't do it with DNS (DNS resolves only domain names to IPs, and have nothing to do with whatever comes after "/"), but you can do it with URL forwarding. Often DNS (especially dynamic DNS) providers also offer URL forwarding service, try companies like no-ip.com and such.

查看更多
\"骚年 ilove
4楼-- · 2019-02-11 04:33

You can do this with prefixes. A.example.com --> 100.100.100.100 and B.example.com -->200.200.200.200

查看更多
登录 后发表回答