Web app selection in Traccar 5.3

The modern interface is getting better and better, but we still have users who prefer Legacy. It would be great to have the switch link between versions (new vs old) for a while longer, as it was in the login screen of previous versions.

Anton Tananaev2 years ago

You can run both at the same time. You just need a bit more complicated Apache (or other web server) setup to do it. For example, our official subscription server has both on different domains:

https://server.traccar.org/
https://legacy.traccar.org/

Thank you Anton! I will search some post about this. Sugestions?

Anton Tananaev2 years ago

I don't think there's any step by step guide available. You probably read about Apache configuration, specifically virtual hosts and proxy.

doesn't really exist. Create a new virtualhost in Apache I understand, but I believe you are referring to creating a second instance where the web.path is different. That's right?

if it's just a webserver configuration, could you show us an example of what you use on your server to do this?

Anton Tananaev2 years ago

It's Apache only configuration. You don't need two instances of Traccar or any special configuration in Traccar. Here are the two Apache configs that we have:

/etc/apache2/sites-available/traccar.conf

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>

                ServerName server.traccar.org
                ServerAdmin webmaster@localhost

                DocumentRoot /var/www/html

                ProxyPass /api/socket ws://localhost:8082/api/socket
                ProxyPassReverse /api/socket ws://localhost:8082/api/socket

                ProxyPass / http://localhost:8082/
                ProxyPassReverse / http://localhost:8082/

                SSLEngine on

                Include /etc/letsencrypt/options-ssl-apache.conf
                SSLCertificateFile /etc/letsencrypt/live/server.traccar.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/server.traccar.org/privkey.pem
        </VirtualHost>
</IfModule>

/etc/apache2/sites-available/legacy.conf

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>

                ServerName legacy.traccar.org
                ServerAdmin webmaster@localhost

    DocumentRoot /opt/traccar/legacy
    DirectoryIndex release.html

    <Directory /opt/traccar/legacy>

                Require all granted
                AllowOverride None
                Order allow,deny
                Allow from all
    </Directory>

                ProxyPass /api/socket ws://localhost:8082/api/socket
                ProxyPassReverse /api/socket ws://localhost:8082/api/socket

                ProxyPass /api http://localhost:8082/api
                ProxyPassReverse /api http://localhost:8082/api

                SSLEngine on

                SSLCertificateFile /etc/letsencrypt/live/server.traccar.org/fullchain.pem
                SSLCertificateKeyFile /etc/letsencrypt/live/server.traccar.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
        </VirtualHost>
</IfModule>

Fantastic Anton! thanks for the direction! As there seem to be others interested, I'll post a step by step as soon as I get it.

Anton Tananaev2 years ago

You might need to set up permissions on the /opt/traccar/legacy folder so that Apache can access it.

GPS12 years ago

hello,

i created /etc/apache2/sites-available/traccar.conf and /etc/apache2/sites-available/legacy.conf

inside of this two files i replaced server.traccar.org and legacy.traccar.org with server.mydomain.com and legacy.mydomain.com

a2dissite 000-default
sudo a2ensite traccar.conf
sudo a2ensite legacy.conf
sudo service apache2 restart

i created A records for both server.mydomain.com and legacy.mydomain.com .

I installed letsencrypt and i generated cerificates for both server.mydomain.com and legacy.mydomain.com .

Legacy and Modern works having ssl Letsencrypt , but Legacy and Modern dont work in the same time .

To have legacy i put in default.xml web path ./legacy and to have modern i put ./modern in the default.xml .

At the moment when i have in the default.xml web path ./legacy , accesing server.mydomain.com go to legacy and also accesing legacy.mydomain.com go to legacy .

At the moment when i have in the default.xml web path ./modern , accesing server.mydomain.com go to modern and also accesing legacy.mydomain.com go to modern .

The question remain the same : how to make run in the same way is running legacy.traccar.org and server.traccar.org

Anton Tananaev2 years ago

You're doing it wrong. DO NOT change web.path anywhere.

Sophiaa year ago

To have legacy i put in default.xml web path ./legacy and to have modern i put ./modern in the default.xml .

URLEY REYa year ago

I have done this same procedure, but it has not worked for me. I think there is something that is not clear and it is if I should leave web.pacth configured as modern or legacy?

GBa year ago

Can "web app selection" both modern and legacy be set per user?
I ask because some of my users prefer the legacy version and other users prefer the modern version.
Users are complicated :-(

Anton Tananaeva year ago

There's another thread on the forum where we discussed having both web apps running in parallel. You should check that.