possible to resolve DNS based on URL path

做~自己de王妃 提交于 2019-12-30 05:26:09

问题


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.


回答1:


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.




回答2:


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.




回答3:


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



来源:https://stackoverflow.com/questions/11624360/possible-to-resolve-dns-based-on-url-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!