Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow start_url within the site webmanifest be set via configuration or some other means #16256

Open
Lhachtoo opened this issue Feb 1, 2025 · 3 comments
Labels
enhancement New feature or request

Comments

@Lhachtoo
Copy link

Lhachtoo commented Feb 1, 2025

I want to be able to install Frigate as a PWA or create a bookmark on Android+iOS when Frigate is hosted behind a proxied URL path (https://server.com/frigate). I successfully experimented with modifying site.webmanifest 's start_url and now have the PWA pointing to the correct URL.

I would like start_url to be set via configuration or some other means (such as the X-Ingress-Path header)

An alternative is manually modifying the manifest file to include the proxied path (e.g. site_url = "/frigate/")

See some previous discussions: #16238 and #13603

@Lhachtoo Lhachtoo added the enhancement New feature or request label Feb 1, 2025
@bartbutenaers
Copy link

@Lhachtoo
So glad I found your feedback here, because I am also stuck with it. Thank you for digging into this!

Would be nice if you could share how you can modify manually the site.webmanifest file?
I assume it is inside some kind of bundle file, because I cannot find it inside my Docker container.

Hopefully somebody knows how to implement your feature request, so we have a decent solution that allows us to upgrade easily to new Frigate versions (without manually changing code files).

Thanks already!!
Bart

@Lhachtoo
Copy link
Author

@bartbutenaers I use the provided stable Docker container for Frigate. I simply found the local copy of the webmanifest file and edited it.

$ docker exec -t frigate ls /opt/frigate/web/assets/ | grep -o "site.*webmanifest"
site-YVb_R6Qj.webmanifest

$ vim `locate site-YVb_R6Qj.webmanifest`   # which resolved to somewhere in /var/lib/docker/.....

There's probably a proper way to do this, such as mapping a custom webmanifest file in docker-compose.yml, but this is my first experience with Docker and editing the file directly worked.

Also, be sure to clear the cache for your site from your browsers after making the change.

@bartbutenaers
Copy link

@Lhachtoo
Thanks for sharing the needle in the haystack!
That was really helpful.

I need to run Frigate at base-path /frigate. But the reverse proxy in my Tailscale agents don't allow me to set the http header X-Ingress-Path to "/frigate", as required by Frigate. So I need to change manually the Frigate Nginx conf file as described in this workaround.

Since I want to limit the number of files that I need to change manually, I tried to find a way to update the webmanifest file (dynamically as soon as it is being fetched) also via the Nginx proxy file. This seems to be working:

 # For PWA apps the start_url in the manifest file should be the base-path '/frigate'
 location ~ ^/.*-([A-Za-z0-9]+)\.webmanifest$ {
      access_log off;
      expires 1y;
      add_header Cache-Control "public";
      default_type application/json;
      proxy_set_header Accept-Encoding "";
      sub_filter_once off;
      sub_filter_types application/json;
      sub_filter '"start_url": "/"' '"start_url" : "/frigate"';
  }

Here is the position inside my nginx.conf file where I have added it:

Image

Hopefully it can be of any help to other users...

P.S. I have changed the Nginx conf file using these commands:

  1. Open the terminal window of the Docker container: sudo docker exec -it frigate /bin/bash
  2. Inside the terminal window:
    1. Load list of packages apt-get update
    2. Install the nano text editor apt-get install nano -y
    3. Change the Nginx config file nano /usr/local/nginx/conf/nginx.conf
    4. Leave the container exit
  3. Restart the container docker restart frigate

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants