sergix44 / XBackBone

A lightweight file manager with full ShareX support and more
https://xbackbone.app
GNU Affero General Public License v3.0
993 stars 81 forks source link

Default Nginx config breaks Discord embeds #492

Closed LobaDK closed 1 year ago

LobaDK commented 1 year ago

System Info

Using the provided Nginx config from the repository causes requests to https://example.com/UserCode/filename.png to silently 404, causing Discord to fail to embed the image. Viewing the page, the file still displays, as it instead fetches the /raw version, however Discord is not capable of grabbing that instead I guess.

Swapping back to Apache immediately fixes the issue.

To reproduce Steps to reproduce the behavior:

  1. Paste image link into Discord
  2. See no embed
  3. Check website and see image
  4. Open Dev Console and see 'GET https://example.com/UserCode/filename.png 404'

Expected behavior Discord embeds the image

Logs 2022/10/17 04:19:15 [error] 2767757#2767757: *281 open() "/var/www/sharex/QaBu2/YeGaVEWI39.png" failed (2: No such file or directory), client: , server: sharex.lobadk.com, request: "GET /QaBu2/YeGaVEWI39.png HTTP/2.0", host: "sharex.lobadk.com"

LobaDK commented 1 year ago

Under more extensive testing I have discovered that the Cache-control header I added to Nginx, which tells the browser to cache image files, is somehow causing this. Only file types in the Cache-control list had the issue, and adding/removing file types from the list broke/fixed them.

I am not entirely sure how or why the Cache-control would cause this, but at least it's fixed now. I apologize for taking any of your time.