微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

web-applications – Meteor无限重定向而不是渲染404

我的/lib/router.coffee中有一个简单的铁路由器配置:
Router.configure
  notFoundTemplate: "notFound"

Router.map ->
  @route "app",path: "/"
    template: "app"

当进入/它的工作,但如果我尝试转到/ abc然后它重定向我/#!abc,之后它重定向我在/ abc,所以无休止地重复(我在浏览器的地址栏中看到这些更改,在浏览器日志重定向中从/到/ abc和后面).我从来没有看到404错误.

有没有人遇到过这种行为?

我使用Meteor v1.0.2.1.有我的流星列表:

alethes:lodash           0.7.1
appcache                 1.0.3
coffeescript             1.0.5
ground:localstorage      0.1.7
ground:store             0.1.1
ianhorst:bower           0.0.2
iron:router              1.0.6
meteor-platform          1.2.1
meteorhacks:kadira       2.15.2
peerlibrary:async        0.9.0_3
rzymek:moment            2.8.3_10
rzymek:moment-locale-ru  2.8.4

我也在客户端使用Framework7.

解决方法

你所拥有的是旧的铁路由器API,在新的路由器中,我的最后一条路线如下所示:
Router.route('/(.*)',function() {//regex for every route,must be last
    if (this.ready()) {
        document.title = "404";
        this.render('error');
    } else this.render('loading');
})

原文地址:https://www.jb51.cc/html/231585.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐