Most likely it's because modern web app expects API to be at the root.
how to access traccar modern with https? config like above not work
It should work with root. If you want to uses non root folder, you need to recompile the app.
How to recompile the modern app?
I checked this: https://www.traccar.org/build-web-app/
It covers these 3 topics:
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.
You have to download the source code. Then you can do npm run build
in the modern folder.
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?
No, obviously you have to make the path change first.
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.
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.
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?
The page you're referring to is the right page. Just ignore the last part.
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"?