How do I route by domain / subdomain in rails

我的未来我决定 提交于 2019-12-30 11:15:16

问题


I looked at subdomain-fu and it looks pretty easy to route all non-www and non-'' subdomain requests to a single controller.

But I also, need to send all external domains that are CNAME'd to my domain to the same controller. I have done a lot of searching and I can't find anything.

Summarized, if it is a subdomain on my domain it goes to Catchall controller, if it is any other domain than my domain, it goes to the same Catchall controller.

I am going nuts on this, any help would be appreciated.


回答1:


You should check out the request_routing plugin. It allows you to easily route request by: subdomain, domain, method, port, remote_ip, content_type, protocol, etc.



来源:https://stackoverflow.com/questions/2283755/how-do-i-route-by-domain-subdomain-in-rails

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