Traccar Login page hangs when trying to login (shows spinner)

Track-trace2 years ago

Im running 4.8 for a long time already.

Since today i cant login to the web interface. Did restart the server etc.

When looking at the browser console i see that two external cdn files cant be loaded.

ol.css and ol.js Status Code 403 for those files since its external how to change that ?

Chrome Console

Can this be the reason that the weblogin page does not load? and how to solve that ?

marc2 years ago

I have noticed this too. Since a few days ago. Just a spinner. Nothing else.

https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.1.1/css/ol.css Failed to load resource: the server responded with a status of 403 ()

https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.1.1/build/ol.js Failed to load resource: the server responded with a status of 403 ()

server "403" = 'Forbidden' .

I would guess the content delivery network (CDN) has blocked access for some reason. That's all I know.

Track-trace2 years ago

Hi, yes i saw that, it seems they removed those files. Question is how i can host those files on my own local server (and where to find those ol.css and ol.js files).

And would that be the reason i cant login to the website ? Will it solve my login problem when i host those files locally?

I found that these files are loaded through load.js

addStyleFile('https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v' + olVersion + '/css/ol.css');
addScriptFile('https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v' + olVersion + '/build/ol.js');

When i would have those files and add them to the local server and adding the local path in load.js and recompile would be the solution ?

marc2 years ago

It looks like the CDN has done more than removed them. If they'd just removed them the status code would be "404". The status code is "403 (Forbidden)" = the files may be still there but access intentionally blocked. For some reason, I don't know.

I guess a workaround for now would be to self-host these two files. And to tell the Traccar Server it is hosting them instead, = manually hack Traccar's coding of load.js (and any others needed).

Another thing that's just come to mind, is this may had been an pending future issue that already was pre-solved in a previous release of Traccar Server. If so then users of the updated version won't be having this 'freezing spinner' problem

Track-trace2 years ago

Yes i understand. It might also be that the directory where those files should be is forbidden. Anyway Basicly we say the same thing. In the mean time i found the needed files.

https://sourceforge.net/projects/openlayers.mirror/files/v6.1.1/

So ill host the needed files on my own server and point load.js to it and see what happens. Ill test it later today.

Ps.
I still need 4.8 since i have many modifications which will break the code of newer releases (and im not the tech that can easily fix it).
But testing the above solution should be doable for me :)

Track-trace2 years ago

Actually i found that it is not needed to recompile tracker-server. You just need to upload the files ol.css and ol.js to a webserver, you can get it from the zip https://sourceforge.net/projects/openlayers.mirror/files/v6.1.1/ . The files can even be uploaded where you host traccar server. So upload the files ol.css and ol.js to the directories you create in the webroot like webroot/css and webroot/build

then edit load.js in traccar/web/

and change the lines.
To

addStyleFile('https://replace-with-your-ip-or-url/css/ol.css');
addScriptFile('https://replace-with-your-ip-or-url/build/ol.js');

Test if the files are accessible through the internet in your browser

If so, Then save load.js and restart the server. Then it works. If you read this let me know if it works for you.

Track-trace2 years ago

In the above example after saving load.js you should restart the tracker-server.jar

Actually thinking about the whole situation and not being able to login just because some external files are not available is a rather weak position to depend on right ?

Once "they" decide to delete those files your whole server is wracked until the point that you find out where to get those files and host them yourself.
So, to be sure. Also download the external files just to have them as backup.

Anton Tananaev2 years ago
marc2 years ago

Just to add:.. Curiously, rolling back to an older version of the ol.js and ol.css works too. This suggests the CDN might not intentionally blocked access with 403 Forbidden.

From this same CDN jsdelivery.net, their older versions are not blocked:
https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/css/ol.css
https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js

Track-trace2 years ago

Thanks for the solution @Anton,

I have now downloaded all external files from cdnjs.cloudflare.com and cdn.jsdelivr.net so that it can be loaded locally through load.js and served through my own webserver. It also speeds up the load times.

kawstraining2 years ago

had the same problem for the past few days, I had noticed the jsdelivr CDN down, I found your solution and it is fixed with no more endless blue spinning circle. Many people probably have this problem which started a few days ago.

marc2 years ago

To summarise a fix to get things working, is manually edit /opt/traccar/web/load.js

Look for

addStyleFile('https:/ /cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v' + olVersion + '/css/ol.css');

addScriptFile('https:/ /cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v' + olVersion + '/build/ol.js');

Replace the bold parts with the URLs provided by Anton.

https://cdn.traccar.com/js/ol/6.1.1/ol.css
https://cdn.traccar.com/js/ol/6.1.1/ol.js

An alternative quick and dirty fix is (in load.js) instead simply replace "6.1.1" with "5.3.0" - to use the older versions which are not currently blocked.

If still a spinner. Had you restarted the server? Your browser might also be reloading the unedited load.js from cache. Pressing Shift-F5 sometimes is a quick fix.

Track-trace2 years ago

Good to see that it did not only solve my problem. To add to the above summarized conclusion i would add that its still the best solution to also download these external files. Not only from cdn.jsdelivr.net but also from cdnjs.cloudflare.com
In load.js you can see which files are needed. Its always a good idear to have a backup of essential files in case other servers (then yours) go down.

Julio Adrian T2 years ago

Thanks a lot for the solution all of you guys!

I followed the summary by marc and now my server is fixed.

Cheers,

PawBuda year ago

Alright, so I am facing the exact same problem https://ibb.co/nB9cwsp (markdown isn't working with this URL for some reason) when trying to build it locally on macOS Ventura 13.4, apparently load.js is giving me the issues shown in the aforementioned screenshot with the latest pull from Traccar's GitHub repository. As can be seen, an error 404 is shown which restricts loading the login page.