Reverse proxy setup

shiftylilbastrda year ago

I have Traccar running in docker on a Linux machine and am trying to reverse proxy it through NGINX (Swag) and I can reach the UI through my domain. I installed the client app on my phone and set the domain to https://traccar.mydomain.xyz. I then added the phone in the server using the identifier supplied in the app. I am not however seeing the device being tracked in the UI. Any help would be appreciated.

Anton Tananaeva year ago

Have you enabled WebSocket proxy?

shiftylilbastrda year ago

Is that in Traccar?

Anton Tananaeva year ago

No, in your proxy.

shiftylilbastrda year ago

I just added WEBSOCKET_ENABLED to my docker variables, still no data. It also keeps making me reregister every once in a while.

shiftylilbastrda year ago

Not sure where I would put that in my proxy conf. I mostly use existing templates. My current conf for traccar looks like this.

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name traccar.*;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    # enable for ldap auth (requires ldap-location.conf in the location block)
    #include /config/nginx/ldap-server.conf;

    # enable for Authelia (requires authelia-location.conf in the location block)
    #include /config/nginx/authelia-server.conf;

    # enable for Authentik (requires authentik-location.conf in the location block)
    #include /config/nginx/authentik-server.conf;

    location / {
        # enable the next two lines for http auth
        #auth_basic "Restricted";
        #auth_basic_user_file /config/nginx/.htpasswd;

        # enable for ldap auth (requires ldap-server.conf in the server block)
        #include /config/nginx/ldap-location.conf;

        # enable for Authelia (requires authelia-server.conf in the server block)
        #include /config/nginx/authelia-location.conf;

        # enable for Authentik (requires authentik-server.conf in the server block)
        #include /config/nginx/authentik-location.conf;

        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app traccar;
        set $upstream_port 8082;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }
}
shiftylilbastrda year ago

Turns out I needed to turn the service off and back on in the phone app and it started working