NetworkError: 404 Not Found, 403 Forbidden

My Elgg installation is in http://www.mysite.com/demo/ and I'm getting errors like this:

"NetworkError: 404 Not Found - http:/www.mysite.com/demo/mod/template_switcher/vendors/jquery-cookie%5Cjquery.cookie.js"

"NetworkError: 403 Forbidden - http:/www.mysite.com/demo/cache/0/default/js/theme/update.js"
 
In htaccess I've tried with and without RewriteBase /demo/
 
Anybody knows what could be the problem?

 

  • I probably didn't make that clear from the beginning. The error is with template switcher enabled. Which requirements to server config could change using a plugin like this?
     

  • If it's only due to the theme switcher plugin then I would say your server config is perfectly alright and the Elgg installation is also perfectly alright. It's a bug (or bugs) in the plugin alone that result in the errors.

    The 404 error could be explained by the typo in the path as already mentioned. The 403 error could be a follow up caused by the 404 error (or maybe due to the update.js not being correctly registered and loaded). I don't know if the theme switcher plugin might also want to create / access a directory (either within it's plugin folder or within the data directory) and fails due to wrong acess permissions.

    Is the update.js even a AMD module? I had much trouble with some js libraries when porting the Elggchat plugin to 1.9, too - see https://community.elgg.org/discussion/view/1827358/how-to-correctly-use-elgg-register-js-elgg-define-js-on-elgg-18-and-19. If the library isn't an AMD module you might want to try elgg_register_js() / elgg_load_js() instead of elgg_define_js() / elgg_require_js().

  • @iionly Thank you for your comment, you are always thorough.

    The update.js, tabs.js, theme.js or whatever I put in /views/default/js/plugin/ (neither works) is custom js defined as amd. That's what we are encouraged to do as of Elgg 1.9, as I understand it. It could be something like this:

    define(function(require) {    

        var $ = require('jquery'); require('isotope');

        $(function() {
            
            var $container = $('#container');
            // init
            $container.isotope({
                // options
                itemSelector: '.elgg-item',
                layoutMode: 'fitRows'
            });
        });
    });

    I even tried to empty the js files, errors are still there.

    I read the thread about your problems with elggchat, and should probably check out if the old js way will work. But all my plugins have been tested in localhost and online and there are no js errors, or other errors for that matter, without theme switcher.

    What is different in the way Elgg loads js via elgg_require_js('mytheme/update'); and elgg_extend_view('js/elgg', 'js/mytheme/update');

  • Have you ever found out what the problem was Per?
    I just tried out your mobilize plugin and I have this 'forbidden' error with a lot of JS files and it only occurs with caching disabled.

  • @Dries, I never found out. The plugin mentioned just didn't work with elgg_require_js.

    Mobilize uses elgg_register_js to load a js snippet with an iOS 5 link fix. You could try to comment out the register and load lines in start.php and see what happens. Are you on 1.10?

     

     

  • Thanks Per,

    That doesn't really solve the issue, I suppose it has something to do with the viewtype (mobile) this seems to be causing caching issues.
    Looks like I can't access default viewtype cached files in a different viewtype then 'default'.
    The problems only occur whenever I'm in the other viewtype.
    Maybe this was the case for your problem as well, I suppose your theme switcher is using different viewtypes for each theme as well?
    Anyway, I'll investigate this further when I have some time and report back.