如何修复这个CouchDB重写处理程序的无限循环?

时间:2012-03-29 11:40:34

标签: redirect url-rewriting couchdb infinite-loop couchapp

如果我在CouchDB应用程序中不使用重写,我的静态文件链接会中断:

GET http://127.0.0.1:5984/mythshare-dev/_design/mythshare/_rewrite/static/js/jquery-1.7.1.min.js 404 (Object Not Found)
GET http://127.0.0.1:5984/mythshare-dev/_design/mythshare/_rewrite/static/js/json2.js 404 (Object Not Found)
GET http://127.0.0.1:5984/mythshare-dev/_design/mythshare/_rewrite/static/style/example.css 404 (Object Not Found)
modules.js:4264Uncaught ReferenceError: $ is not defined

所以我添加了这个重写以修复损坏的链接:

{from: '/static/*', to: 'static/*'}

我的断开的链接已修复,但处理程序无法正常工作。 modules.js句柄功能与...不匹配...

exports.handle = function (method, url, data) {
    if (exports.unknown_target) {
        window.location = exports.getBaseURL() + url;
        return;
    }

    // match resolves to FALSE
    var match = exports.matchURL(method, url);
    ...

导致这一点:

    ...
    else {
        // this log is written over and over in the console
        console.log(method + ' ' + url + ' -> [404]');
        window.location = exports.getBaseURL() + url;
        return;
    }

页面现在不断刷新,陷入无限循环。

如何将重写写入静态目录,以便正确解析并匹配?

1 个答案:

答案 0 :(得分:0)

删除modules.js模板中base.html的脚本代码。