dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
17.3k stars 965 forks source link

Your BASE_URL var is currently "" #269

Closed weibell closed 2 years ago

weibell commented 2 years ago

Under /settings#notifications, the text below the table of tokens reads:

URLs generated by changedetection.io (such as {diff_url}) require the BASE_URL environment variable set.
Your BASE_URL var is currently ""

This is even though BASE_URL is correctly set using the General tab and confirming that it token correctly works within notifications. I am running the latest ghcr.io/dgtlmoon/changedetection.io docker image.


On a related note, I experienced the issue that BASE_URL was empty if it was not set using the General tab, but using a Docker environment variable instead. I confirmed that the variable was correctly set by running echo $BASE_URL in the container, but within notifications (and the text below the table of tokens), the corresponding token appears to be treated as empty.

dgtlmoon commented 2 years ago

Hey - Hmm so you're saying it works, except that you see Your BASE_URL var is currently "" , right?

weibell commented 2 years ago

Yes, when setting the variable using the General tab, it works, even though I see that incorrect text.

When I instead use a Docker environment variable, it does not work.

dgtlmoon commented 2 years ago

Just to confirm

When I instead use a Docker environment variable, it does not work.

you're saying that the BASE_URL that you set never appears in the notification that is sent?

weibell commented 2 years ago

Precisely. Let me provide some more details:

docker-compose file:

...
      environment:
        - BASE_URL=http://example.com/
...

Docker container:

root@changedetection:/app# echo $BASE_URL
http://example.com/

General tab (field is empty): image

Notifications tab: image

Notification email for http://www.quotationspage.com/random.php: image

dgtlmoon commented 2 years ago

@weibell any chance you can test https://github.com/dgtlmoon/changedetection.io/tree/ticket-269-incorrect-baseurl-shown

https://github.com/dgtlmoon/changedetection.io/pull/271 ?

jeremysherriff commented 2 years ago

@dgtlmoon I've tested PR #271 and it works well. I had the same issue as OP.

The docker environment BASE_URL is now reflected in the main settings page, the notifications page, and the notification settings for each watch.

Notifications generated with {diff_url} are correct.

Tested with both direct http://ipaddress:port and reverse-proxy+subfolder http://reverse.host.com/app/ access and everything is working well.

Note that you have a capitalisation error in the /settings#general page: image

It is correct on the /settings#notifications page: image

dgtlmoon commented 2 years ago

@jeremysherriff re capitalisation error - I dont follow your partial screengrab of the text, can you perma-link me to the line in github on that branch?

jeremysherriff commented 2 years ago

@dgtlmoon it's here: https://github.com/dgtlmoon/changedetection.io/blob/0a29b3a58252986d8ce86637c6438a64cefb6abf/changedetectionio/templates/settings.html#L39