如何在rails中按域/子域进行路由 [英] How do I route by domain / subdomain in rails

查看:177
本文介绍了如何在rails中按域/子域进行路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看着subdomain-fu,将所有非www和非子域名请求路由到单个控制器看起来很简单。

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

但是我也是,需要将CNAME的所有外部域发送到我的域到同一个控制器。我已经做了大量的搜索,我找不到任何东西。

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.

总结一下,如果它是我的域上的一个子域名,它将转到Catchall控制器,如果它是其他领域比我的域名,它去同一个Catchall控制器。

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.

推荐答案

您应该查看 request_routing 插件。它允许您轻松地路由请求:子域,域,方法,端口,remote_ip,content_type,协议等。

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.

这篇关于如何在rails中按域/子域进行路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆