/api/socket returns 405 Method Not Allowed

Zangetsua year ago

Hi,
Does the latest version "5.10" have issues with connecting into websockets? I'v tried to connect via 3 different environments (azure Linux vm, Linux laptop and windows) and I had friends trying as well and it's the same error. I tried on localhost:8082, reverse proxy with secure connection as mentioned here (https://www.traccar.org/secure-connection/). I used Apache and Nginx, on root and subdir, and still same error. I debugged so much that I can't find anything else not working but the server. Everything else in the /api/ works except for sockets. Can you suggest a version where /api/socket is reported working?

Track-tracea year ago

Whats the error message ?

Zangetsua year ago

Using the below command:

curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" -H "Host: echo.websocket.org" -H "Origin: http://localhost:8082" http://localhost:8082/api/socket

Returns:

HTTP/1.1 405 Method Not Allowed
Date: Tue, 12 Dec 2023 09:58:22 GMT
Cache-Control: must-revalidate,no-cache,no-store
Content-Type: text/html;charset=iso-8859-1
Content-Length: 99
Server: Jetty(11.0.18)

<!DOCTYPE><html><head><title>Error</title></head><html><body>405 - Method Not Allowed</body></html>
Anton Tananaeva year ago

The official web app is using web socket, so you can easily confirm if it's working. If it's not, it's probably some misconfiguration on your end because it's working for everyone else.

Zangetsua year ago

The web app is working indeed. I followed the installation guide on both linux and windows, there's no specific configuration to get /api/socket to work, especially not any different from getting anything else within the api to work, right?
how come then I keep getting the same error on more than 5 different machines using different OS's, different networks?
I checked other's forums, disabled firewalls, but nothing really matters. It seems like a server issue.
In addition, I don't see anything related to the socket connection in the traccar default.conf or the suggested traccar.conf. is this normal?

Anton Tananaeva year ago

You don't need to configure anything extra in Traccar.

Zangetsua year ago

Exactly, then it should just work when operating on 'http://localhost:8082' 'http://localhost:8082/api/socket'
But, it's not. That's the reason why I'm saying it's a server issue.

Anton Tananaeva year ago

Have you checked if it's working in the web app? If yes, it's clearly not a server issue.

Zangetsua year ago

Do you mean the socket that appears when inspecting the web app? it gives 101 with time 'pending' and 'Connection start: stalled' and queued for the same time it started and size is always 0 B.
Or is this isn't what you asked?

Anton Tananaeva year ago

Yes.

Zangetsua year ago

I assume "Yes" means that's what you meant. So given that, would you consider this working or not? For me it seems like not, since it's not the usual behavour like other process, such as server, devices, groups, etc.. they all have sizes, give 200, time is few milli seconds and waterfall seems healthy.

Anton Tananaeva year ago

Sounds like it's not working in your case. It's working for most other people, so it's very unlikely that it's the server itself. More likely some network configuration issue.

Zangetsua year ago

Do you have any suspicion or suggestions on what it could be? I can't really pinpoint a specific configuration since I had the same issue on multiple OS's and networks.

Track-tracea year ago

If its a network issue you should think about a firewall / switch / router.

Why dont you install the same server on vps (there are many providers where you can have a free trial). This way its easy to root out the cause (your Lan etc).

Thiago Azevedoa year ago

Hello @Zangetsu, I have the same problem, by any chance, did I manage to solve it?