Nginx Proxy working!

oharahay 4 years ago

@dreamway

Thanks. this solution works. but i ran into a problem. I still have vaultwarden installed.
with this configuration, the /api path that belongs to vaultwarden gets into the rewrite rule and is passed to traccar.
causing vautwarden to stop working properly

172.xxx.xxx.xxx - - [15/Jun/2022:15:17:06 +0300] "POST /api/session HTTP/1.1" 404 251 "https://mx3.sat.com/modern/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15"
172.xxx.xxx.xxx - - [15/Jun/2022:15:17:27 +0300] "POST /api/session HTTP/1.1" 404 251 "https://mx3.sat.com/modern/login" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15"

can you tell me how to solve this problem?

dreamway 4 years ago

@oharahay

In that case, I think you cannot apply this solution.

Maybe you should try this.

  1. Use Zecman's solution (/gps)

  2. Build Traccar web using npm run build_release with PUBLIC_URL=/gps/modern
    See also README.md (https://github.com/traccar/traccar-web/tree/master/modern)

  3. Apply newly built web frontend from the Step 2 on your traccar web folder (/opt/traccar/web)

I've never tried this myself but I think it's probably going to work.

In Step 3, you must back up the existing folder and overwrite the file appropriately.

I expect it to be applied as just overwriting files, restarting traccar, and remove caches your web browser, but in case you need to look at how Traccar Web works.

Zecman 4 years ago

After all these years...

Today we have free SSL certs from multiple companies like LetsEncrypt. I do not see the need for subdirectory hosting any more. I switched to subdomain hosting like gps.my-domain.com.

Then it is nothing more than a simple reverse proxy. Traccar has it's own subdomain and no rewrites are needed any more. Your subdirectory issue also would never happen.

If you are looking for a good webserver with easy reverse proxy features which also does all the certificate management on its own: Caddy Server