如何在 Rails 中按域/子域进行路由
我查看了 subdomain-fu ,看起来很容易将所有非 www 和非“”子域请求路由到单个控制器。
但我还需要将 CNAME 到我的域的所有外部域发送到同一控制器。我做了很多搜索,但找不到任何东西。
总之,如果它是我的域上的子域,它会转到 Catchall 控制器,如果它是我的域以外的任何其他域,它会转到同一个 Catchall 控制器。
我对此很着迷,任何帮助将不胜感激。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该查看 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.