HTTP 401 Unauthorized

javier2602 years ago

Hello,
I've just updated docker server from 4.13 to 5.3, and also traccar manager app in my android, so not sure if the issue is in the server or in the app, sorry, or maybe no issue at all, :)

After some minutes (maybe hours) I'm getting error HTTP 401 Unauthorized - WebApplicationException (SecurityRequestFilter:126...) in my traccar manager app when I try to do, p.e. a Replay. I see I get the same error immediatly if I restart the server.

In server logs I'm getting the following:

2022-08-26 15:59:52 DEBUG: Starting mapping of the exception. - HTTP 401 Unauthorized - WebApplicationException (SecurityRequestFilter:126 < ...)
2022-08-26 15:59:52 DEBUG: Exception 'HTTP 401 Unauthorized' has been mapped by 'org.traccar.api.ResourceErrorHandler' to response 'Unauthorized' (401:CLIENT_ERROR).

Any idea about how to solve it?
Thanks

Anton Tananaev2 years ago

You shouldn't enable debug logging. It prints out too much information that's impossible to analyze. Keep the standard logging level.

Did the server restart?

javier2602 years ago

I activated "all" logging just to check if I can see what's happening, but it's failing with "info" logging also.

Yes, server is working well but I have to enter user credentials another time if I want to see updated information. If not, I see old possition of devices, and the 401 error if I do some other actions. It's like session is expired, and I need to do logout and login another time.

Anton Tananaev2 years ago

It shouldn't happen, unless the server restarted. And that's why I asked this very specific question.

javier2602 years ago

I'll try to check how much time is needed to lose the session from traccar manager app. Maybe it could help.
Thanks

javier2602 years ago

Hi. I was not able to reproduce the same issue, I don't know the reason because I'm using the same server version and same mobile traccar manager app version. Maybe a reinstall of server, or app, or rebooting the mobile. The issue I see now (probably related with the one described in this post) is the same as in the following post. Because it's not exactly the same issue, I finish this topic and I'll post in the following one:
https://www.traccar.org/forums/topic/android-mobile-app-device-data-refreshing-problem-on-server-52/
Thanks for your help.

Jtcruza year ago
HTTP 401 Unauthorized - WebApplicationException (SecurityRequestFilter:126 < ...

How did someone manage to solve this problem? I have 600 vehicles registered and this error appears on the screen, I have to log out and log back into traccar for it to work, after a few minutes the error appears again.

I use version 5.5 of Traccar.

Anton Tananaeva year ago

I recommend upgrading first.

Jtcruza year ago

Thanks for your feedback Anton, I'll send you the settings for my VPS (Contabo)

  • 10 vCPU Cores
  • 60GB RAM
  • 400GB NVMe
  • 4 Snapshots
  • 32TB Traffic*
    Unlimited Incoming

I didn't update traccar to a newer version because I made a modification to the login page and it worked great until October 2, 2023

The error below continues to appear

HTTP 401 Unauthorized - WebApplicationException (SecurityRequestFilter:126 < ...)

Followed by the error

503 Service Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Apache/2.4.41 (Ubuntu) Server at mydominio Port 443

I saw in one of your answers on the forum that it could be database.maxpoolsize, does this check in version 5.5? Because I didn't configure this in the settings.

In short, this error appears on the system and a few seconds later the system restarts and asks to log in again. It works for about 3 minutes and gives the error again. I currently have 618 vehicles registered.

Follow my traccar.xml

<properties>

    <entry key="config.default">./conf/default.xml</entry>

    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>nominatim</entry>
    <entry key='geocoder.url'>http://mydominio/nominatim/reverse</>
    <entry key='geocoder.format'>%r, %h, %u, %t, %s, %c</entry>
    <entry key='geocoder.reuseDistance'>5</entry>
    <entry key='geocoder.onRequest'>false</entry>
    <entry key='geocoder.ignorePositions'>false</entry>
    <entry key='server.timeout'>600</entry>

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost/traccar?serverTimezone=UTC>
    <entry key='database.user'>myuser</entry>
    <entry key='database.password'>mypassword</entry>
    <entry key='status.timeout'>1000</entry>

</properties>