3.3 and no last position on map

renaud8 years ago

Hello,

I have freshly installed version 3.3 (and cleared the mysql database). On former versions 2.x, when I clicked on a device, I could see its latest position highlighted on the map and anyway, see the last position of all devices. Now there is nothing when I click on any device. It doesn't matter whether the device is sending data or not, the only way to see where the device is, is in the reports. Clicking on follow button doesn't change anything either.

I am running on OpenBSD 5.8 with the following java version:
$ /usr/local/jre-1.8.0/bin/java -version
openjdk version "1.8.0_45"
OpenJDK Runtime Environment (build 1.8.0_45-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)

renaud8 years ago

Same behavior with:
$ /usr/local/jdk-1.7.0/bin/java -version
openjdk version "1.7.0_80"
OpenJDK Runtime Environment (build 1.7.0_80-b15)
OpenJDK 64-Bit Server VM (build 24.80-b11, mixed mode)

Anton Tananaev8 years ago

Traccar version 3.3 is using WebSocket connection. Make sure nothing blocks it.

You can also try to install version 3.2 (it uses regular HTTP) just to verify that the problem is with WebSockets.

renaud8 years ago

This might indeed be an issue as traccar is configured with web.address=127.0.0.1 and is reverse proxied in https by nginx. How could I allow those websockets in such a configuration, which doesn't seem unrealistic to me nowadays?

I have done the recommended way:
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Which doesn't change anything

Anton Tananaev8 years ago

If you are using proxy, you need to proxy WebSocket connection as well. For Apache there is mod_proxy_wstunnel module. Not sure about nginx, but there must be some solution.

renaud8 years ago

The way to proxy websockets is the one I pointed out on my former message. But that doesn't seem to work.

I changed the configuration to allow listening to 0.0.0.0 and connected to port 8020, and that one shows the devices. So this seems to be indeed due to the reverse proxy.

Could it be because it's httpS?

renaud8 years ago

I changed my reverse proxy configuration to also listen on port 80 and this one works. So there seems to be something related with https.

And unfortunately, as far as I know, traccar doesn't support https natively.

Anton Tananaev8 years ago

Yes... you need to apply a fix to use HTTPS:

https://github.com/tananaev/traccar/issues/1624

renaud8 years ago

Even using stunnel to "sslize" traccar doesn't work.

EDIT: sorry, I didn't see your former reply

renaud8 years ago

That fix doesn't seem to be sufficient. The problem is probably that traccar still sees the connection as being http (because that's how the reverse proxy makes the request) and still uses ws instead of wss.

Anton Tananaev8 years ago

Right... but if the connection to Traccar is usual non-secure HTTP then it should work without any modifications. So, how do you configure WebSocket proxy?

renaud8 years ago

My configuration of nginx is like this and the exact same config works if I remove everything ssl related:

server {
        add_header      Cache-Control   no-cache;
        add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload;";
        expires 31d;
        server_name traccar.example.com;

        ssl On;
        ssl_certificate xxxx;
        ssl_certificate_key xxxx;

        location / {
                proxy_pass http://127.0.0.1:8082/;
                proxy_set_header Host $host;
                proxy_http_version 1.1;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_read_timeout 86400s;
                proxy_buffering     off;
                proxy_connect_timeout 43200000;
                proxy_send_timeout    43200000;
                proxy_redirect off;
        }
}
renaud8 years ago

OK, I have now put the patch you listed and I am using stunnel to "sslize" traccar. So I am using https://traccar.example.com:8083 (stunnel port), and that doesn't seem to work either.

I have also tested by forcing wss in web/app/controller/Root.js without success.

Anton Tananaev8 years ago

There must be a way to make it work... I guess this problem needs more investigation. What is the error you get in browser console? By the way, how did you apply the fix?

renaud8 years ago

I applied the fix by editing web/app/controller/Root.js on the server, restarting traccar to be sure and cleared my browser cache. Isn't that sufficient?
I do not get any error in the nginx server logs, traccar logs or the nohup used to launch it.

The only error I can see in the browser console using stunnel or nginx is:
SecurityError: The operation is insecure. app.min.js:87:0

I see it's using only app.min.js, so that might be the issue, the patch not being applied