我的/lib/router.coffee 中有一个简单的 Iron-router 配置:
Router.configure
notFoundTemplate: "notFound"
Router.map ->
@route "app",
path: "/"
template: "app"
当输入/时,它可以工作,但是如果我尝试转到/abc,那么它会将我重定向到/#!abc,之后它将我重定向到/abc,如此无休止地重复(我在地址栏中看到这些更改)浏览器,在浏览器中日志重定向从/到/abc 并返回)。我从未见过 404 错误。
有人遇到过这样的行为吗?
我使用 Meteor v1.0.2.1。这是我的 meteor 列表:
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。
最佳答案
你拥有的是一个旧的iron-router API,在新的一个中我的最后一条路线如下所示:
Router.route('/(.*)', function() {//regex for every route, must be last
if (this.ready()) {
document.title = "404";
this.render('error');
} else this.render('loading');
})
关于web-applications - Meteor 无限重定向而不是渲染 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27788321/