Accessing ActivityWatch Dashboard via NGINX Reverse Proxy


#1

Hey Guys -

First of all, thanks to all who develop this. I am new to the app, but work from home and must track what I do and this is a big help so far.

I have a quick question, please. On the PC I run the AW server on, I can obviously access the dashboard via http://localhost:5600. I also host many other web apps on the same PC and use NGINX to access them via a reverse proxy and applies SSL at the same time. I’d like to do so with AW so that I can access the dashboard by going to https://mydomain.com/awdash.

Typically, this can be done to almost any web service by configuring it to add a base name (http://localhost:5600/awdash) then adding the below config to NGINX:

location /awdash {
proxy_pass http://localhost:5600/awdash;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;
}

My Issue / Question
My issue is that I cannot find a way to add a URL base to the local address. Does anyone know of a way OR a config that may be used without a URL base path for AW?

Thanks!

UPDATE
After posting, I searched for configs for scenarios like this and tried the below. I was able to successfully start NGINX after the changes so the logic passed, but when trying to access any of the 3 via https://mydomain.com/…, none worked. All would load a blank page (no error) but did have “ActivityWatch” in the browser tab. To note, prior to testing, I changed the INI files to bind to my LAN IP, restarted AW, & tested that it worked. I also tried a variety of URL formats with these configs too…

  location /awdash/ {
  	proxy_http_version 1.1;
  	proxy_set_header Connection "";
  	proxy_pass http://192.168.0.25:5600/;
  }
  
  location  /awdash2 {
  	rewrite /awdash2/(.*) /$1  break;
  	proxy_pass         http://192.168.0.25:5600/;
  	proxy_redirect     off;
  	proxy_set_header   Host $host;
  }
  
  location /awdash3 {
  	proxy_pass http://192.168.0.25:5600/;
  }

Suggestions? Thanks!


#2

That is actually very easy, go into activitywatch/aw_server/static and create a new html page (or even copy the index.html page if you want). I just tried locally to copy index.html into test.html and accessing localhost:5600/test.html works fine.


#3

Great - Thanks for the reply. I’ll give it a shot tonight. Thanks!