getfider / fider

Open platform to collect and prioritize feedback
https://fider.io
GNU Affero General Public License v3.0
2.87k stars 627 forks source link

[BUG] Webhooks URLs for images aren't absolute since v0.21.0 #1083

Closed jorys-paulin closed 2 years ago

jorys-paulin commented 2 years ago

Fider Cloud or Self Hosted Fider self-hosted, version 0.21.0

Describe the bug With the update to v0.21.0, BASE_DOMAIN was removed for single sites but it seems to be used for webhook templates, as such values that looked like https://yourapp.fider.io/static/avatars/letter/1/Test in v0.20.0 now looks like /static/avatars/letter/1/Test, so what was before an absolute URL is now a relative one and doesn't include the site's base url.

This causes issues with targets that expect an absolute URL, like Discord for example (that's how I discovered the problem, they refuse anything that doesn't begin with https://), as Fider sends an URL the target cannot understand.

To Reproduce Steps to reproduce the behavior:

  1. Go to webhooks
  2. Create or edit a webhook
  3. Click on the "more info" icon next to content
  4. Note down the value of author_avatar, it doesn't include the site's base url Try those steps again but in v0.20.0 and prior, this this it includes the site's base url

Expected behavior Variables such as avatar_url should be an absolute URL like https://yourapp.fider.io/static/avatars/letter/1/Test and not a relative one like /static/avatars/letter/1/Test, like it was before v0.21.0 and how it's defined in the documentation

Screenshots chrome_2022-07-03_15-46-50

Additional context This issue doesn't happen when running Fider in "multi" host mode, since the HOST_DOMAIN variable is defined

goenning commented 2 years ago

Do you have the BASE_URL env variable defined?

There were some changes around URL in 0.21, but it shouldn't have impacted this.

jorys-paulin commented 2 years ago

Yes, for our site in production it's set as https://ideas.moonlight-stream.org and on my dev machine it's set as http://feedback.localhost. I've commented out the old HOST_DOMAIN since Fider wouldn't start with it defined, however it seems that same variable is used to make absolute URLs...

jorys-paulin commented 2 years ago

Small note, it seems like the meta tag for open graph is also using relative URLs, don't know if it was already the case though, but just to let you know

goenning commented 2 years ago

Thanks for all the inputs. Can you try using getfider/fider:main image once the last commit is deployed to DockerHub? It should force both OG images and WebHook urls to absolute urls.

jorys-paulin commented 2 years ago

Hello! Tried the newest commit on my dev machine and it works now!

goenning commented 2 years ago

Thanks! The stable docker image has this fix now.