Preview modern UI with secured Traccar (SSL) in non root path.

gustavofarias4 years ago

I have a Traccar 4.12 running behind an Apache2 for both security (SSL) and to be accessible from a non root path.
Just as described here: https://www.traccar.org/secure-connection/

I noticed that I'm unable to preview the modern UI by just putting "/modern" in my URLs.

This must be related to the Apache proxy, since in another install without Apache2 as proxy, I can preview the modern UI just putting /modern in my URLs.

Should I just add entries like the ones bellow changing "gps" for "gps/modern"?

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

ProxyPass /gps/ http://localhost:8082/
ProxyPassReverse /gps/ http://localhost:8082/
ProxyPassReverseCookiePath / /gps/

Redirect permanent /gps /gps/
Anton Tananaev4 years ago

Most likely it's because modern web app expects API to be at the root.

Maulana4 years ago

how to access traccar modern with https? config like above not work

Anton Tananaev4 years ago

It should work with root. If you want to uses non root folder, you need to recompile the app.

gustavofarias2 years ago

How to recompile the modern app?

I checked this: https://www.traccar.org/build-web-app/

It covers these 3 topics:

  1. To run the project in development mode
  2. To change the backend server URL in development mode
  3. To compile a release build, run npm run build

Is the second topic what I need to do?
Not sure how to do the third. Can/should I run npm run build inside the modern folder of an instance I installed from https://www.traccar.org/download/ ? Or I need to download the source code?

I started this thread 2 years ago and I'm still running 4.12 because I can't make the modern app run on a /gps/ or /track/ path.

Anton Tananaev2 years ago

You have to download the source code. Then you can do npm run build in the modern folder.

gustavofarias2 years ago

Why just doing npm run build makes the modern app able to be run in non root path?

Don't I need to change anything? And if not, so why all this?

Anton Tananaev2 years ago

No, obviously you have to make the path change first.

gustavofarias2 years ago

Ok. I have to ask:
What "path change"? Where is it done?

I'm asking too much, but, is it possible to add a few lines about that in here: https://www.traccar.org/secure-connection/
To complement this part "Note that you also need to recompile the modern app for it to work correctly on a new path."

Maybe I'm completely wrong, but I can't imagine a real/serious production traccar not running over https. And I can imagine dozens of reasons to run traccar outside the root path. I think something as essential as this should be put in the regular documentation. Just my opinion. Maybe I'm idiot and nobody needs these 2 features.

Anton Tananaev2 years ago

Our official recommendation is to use a subdomain, not a sub-path. Then you don't need to recompile anything.

As for HTTPS, we have a pretty good documentation for it, so I'm not sure what your point is about HTTPS.

gustavofarias2 years ago

I'm not sure either. It's just the two topics are in the same page: https://www.traccar.org/secure-connection/
Maybe there is a relation between them.

Since subdomains are the recommendation is there any page in the docs that say how to do and what to configure?

Anton Tananaev2 years ago

The page you're referring to is the right page. Just ignore the last part.

gustavofarias2 years ago