Meteor 无限重定向而不是渲染 404 [英] Meteor infinite redirect instead of render 404

查看:26
本文介绍了Meteor 无限重定向而不是渲染 404的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的/lib/router.coffee 中有一个简单的 Iron-router 配置:

I have a simple iron-router config in my /lib/router.coffee:

Router.configure
  notFoundTemplate: "notFound"

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

当输入/时,它可以工作,但是如果我尝试转到/abc,那么它会将我重定向到/#!abc,然后它会将我重定向到/abc,然后无休止地重复(我在地址栏中看到了这些更改浏览器,在浏览器日志中从/重定向到/abc 并返回).我从来没有看到 404 错误.

When entering on / it's works, but if I try go to /abc then it redirects me at /#!abc, after that it redirects me at /abc and so repeated endlessly (I see these changes in the address bar of a browser, in the browser log redirection from / to /abc and back). I never see a 404 error.

有没有人遇到过这样的行为?

Has anyone encountered such behavior?

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

I use Meteor v1.0.2.1. There is my meteor list:

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.

I also use Framework7 in client side.

推荐答案

你有一个旧的 Iron-router API,在新的中我的最后一条路由看起来像这样:

What you have is an old iron-router API, in new one my last route looks like this:

Router.route('/(.*)', function() {//regex for every route, must be last
    if (this.ready()) {
        document.title = "404";
        this.render('error');
    } else this.render('loading');
})

这篇关于Meteor 无限重定向而不是渲染 404的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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