Interesting, i would like to know to.
But why should you want to change the path in the first place ?
A single domain name for you tracking server with letsencrypt will set you back about 8 $ per year.
Looks much nicer to me anyway.
There have been a few recent discussions about it. My opinion is configuring a sub-path makes very little sense. Instead I recommend using a subdomain. What is the use case you need it for?
To Track-trace, I already have a domain name, so using a subdomain costs me $0...
It's just, like for you, using subdomain looks nicer, for me, using subpath looks nicer. I have a lot of services and I always use subpath.
To Anton, aside from aforementioned psychological reason, it's easier to manage reverse proxy (assuming it's supported) and DNS records. But it's not much big of a difference I'll admit. It's mostly just that I like to do it this way...And based on the recent discussion, and the fact that most popular self-hosted services provide this kind of baseurl setting, I think there are a lot of people like me who just prefer using subpath.
Also, subdomain exposes the services I am running (because of DNS records, A or CNAME), but subpath don't. All the outside world sees is one domain, they have no idea I got 10 or 20 services running in subpaths.
I'm sure some other people have other reasons too. Just from the fact that people are always demanding it we kinda see the value for it, I think.
If you publish an app (to appstore, playstore) anyone can see where it connects to.
I don't need to...
Like for traccar I just use the official app and connect to my own server.
When I need to manage/view information, I just use web browser.
Deat Anton,
One more thing I just noticed, for the modern web app, when generating share device, the link is generated using setLink('${window.location.origin}?token=${token}')
which ignores subpath setting.
I have read about https://www.traccar.org/forums/topic/recompiled-modern-app-in-different-path-fails-to-call-server-api/
There are a couple of issues regarding the current guide:
https://www.traccar.org/secure-connection/
https://www.traccar.org/build-web-app/
First of all, there was never any mention of what should be done when recompiling the web app if someone wants to serve traccar under a subpath.
Some old posts refers to adding
"homepage"
topackage.json
which is no longer valid. You seems to switched to vite for building. So now we have to addbase: '/gps',
tovite.config.js
, and this is no where mentioned in the documents.Second, we need to rewrite
/api
to/gps/api
, this is mentioned in the doc, but not emphasized. Besides if already specified with vite config, one would imagine/gps
gets automatically prepended in front of api calls.Third, even with the first 2 steps, I am stilling getting a blank page as mentioned in https://www.traccar.org/forums/topic/recompiled-modern-app-in-different-path-fails-to-call-server-api/
Upon some research, it seems that replacing BrowserRouter with HashRouter fixes the issue. I don't really know javascript so not sure if this is the best solution or not.
I hope the documentation can be improved to help other people. And if using HashRouter is the right way to do it, please change it in the code too. And the api calls should have
/gps
prepended automatically.Thank you!