0

If I don't use a rewrite in my CouchDB app, my static file links break:

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

So I added this rewrite to fix the broken links:

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

My broken links are fixed, but the handler doesn't work properly. modules.js's handle function doesn't match...

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);
    ...

Which leads to this:

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

The page now constantly refreshes, caught in an infinite loop.

How can I write the rewrite to the static directory so it resolves properly and matches?

Matt Norris
  • 8,596
  • 14
  • 59
  • 90
  • It seems like the inclusion of a 'modules.js' file in the base.html file template caused this. After removing it, the page works. However, I will leave this open for a bit in the hopes that someone knows the root cause of the error and can help. – Matt Norris Mar 30 '12 at 02:08

1 Answers1

0

Remove the script tag for modules.js in the base.html template.

Matt Norris
  • 8,596
  • 14
  • 59
  • 90