Live position not updating

catruchos2 years ago

The live position of the devices in my server is not updating, however, the server is receiving the position and storing them correctly, because when I ask to reply the route it is shown perfect. But when I go back to the last position it still showing and old one. I have selected live routes on preferences.
I have searched the forums and I think that I might be a problem with the websockets or with the timezone.
Recently I installed the certificates to make a secure connection through https, and it is working ok, but the live position updates now and then every 5 minutes or who knows when.
If the problem is with the websocket I could not find a way to solve it, I guess that it must be something I have to configure on the https server, in my case is lighttpd and recenthly I adapted it to https with the certificates to be able to see myself on the map in the traccar manager
Also from time to time it gives me a message "failed to fetch" when I try to reply the route.
Any help would be appreciated.

Anton Tananaev2 years ago

Have you configured WebSocket proxy?

catruchos2 years ago

Well I am not sure, because I am using lighttpd and not apache. I forwarded all the incoming connections through a proxy from port 443 to 8082 and the secure connection is working the certificates is ok but maybe I have to open also another proxy forwarding for the websockets that would be ws:// ok I think that it might be the problem.
I will look for how to do it in lighttpd
Once again Thank you very much for your help and your orientation and congratulations for your great application Anton.
i will let know my results in order to help the people that might have the same problem in the future

catruchos2 years ago

Finally it was a problem of the websocket in lighttpd.
The line I had to add in the config was

proxy.header = ( "upgrade" => "enable",
    "map-host-request" => ( "-" => "127.0.0.1:8082"),
    "map-host-response" => ("-" => "-"))

and after that increase a lot the timeout for keep alive the connection because as default is 60 seconds

server.max-read-idle = 3600

My lighttpd config is as follows

server.modules := (
        "mod_access",
        "mod_accesslog",
        "mod_auth",
        "mod_expire",
        "mod_redirect",
        "mod_setenv",
        "mod_rewrite",
        "mod_openssl",
        "mod_alias",
        "mod_compress",
        "mod_proxy"	
     )

\# Maximum number of request within a keep-alive session before the server terminates the connection, default = 16
server.max-keep-alive-requests = 16
\# Maximum number of seconds until an idling keep-alive connection is dropped, default = 5
server.max-keep-alive-idle = 5
\# Maximum number of seconds until a waiting, non keep-alive read times out and closes the connection, default = 60
server.max-read-idle = 3600
\# Maximum number of seconds until a waiting write call times out and closes the connection, default = 360
server.max-write-idle = 360

$HTTP["host"] == "mysite.com" {
    
    # Enable the SSL engine with a LE cert
    $SERVER["socket"] == ":443" {
    ssl.engine = "enable"
    ssl.pemfile = "/etc/letsencrypt/live/mysite.com/web.pem"
    ssl.ca-file =  "/etc/letsencrypt/live/mysite.com/fullchain.pem"
    ssl.honor-cipher-order = "enable"
    ssl.cipher-list = "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4"
    ssl.dh-file = "/etc/ssl/certs/dhparam.pem" 
    ssl.ec-curve = "secp384r1"
    
    setenv.add-request-header   = ( "Connection" => "Upgrade")
    setenv.add-response-header  = ( "Connection" => "Upgrade")
    proxy.header = ( "upgrade" => "enable",
                    "map-host-request" => ( "-" => "127.0.0.1:8082"),
                    "map-host-response" => ("-" => "-"))
                    
    proxy.server  = ( "" => ( "" => ( "host" => "127.0.0.1", "port" => 8082 )))		
                
    }	
}
catruchos2 years ago

Well, after banging my head against the wall. It looks like all my problems were because....
My router had activated a firewall, nothing to do with lighttpd config at all.
I deactivated the firewall and everything is working smooth now

Lesson learned

MAXIMILIANO FLEX7 months ago

Hello friend, the same thing happens to me, my devices do not update the location and I see that the data is being entered in the database. Can you explain how you solved it because I have the same configuration of my SSL certificate. Clarifying that I use traccar 6.1.

catruchos7 months ago

As I said, it was the firewall of the router, after deactivating, It started working properly