如何在 rails 中按域/子域路由

编程入门 行业动态 更新时间:2024-10-23 15:23:46
本文介绍了如何在 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屋!

更多推荐

[db:关键词]

本文发布于:2023-03-26 22:54:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/670306.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:路由   如何在   rails   中按域

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!