ShareX-Upload-Server icon indicating copy to clipboard operation
ShareX-Upload-Server copied to clipboard

Images not previewing in Discord when using SSL (LetsEncrypt/Certbot certificate)

Open mangosd1337 opened this issue 4 years ago • 9 comments

Basically title. I tried a few different servers, domains and certificates now. As soon as you swap from http to https the image previews in Skype, Telegram, Twitter and a few others when the link is posted, just Discord decides to not preview it. Clicking the link displays the image/video/text just fine.

Using Certbot to generate certificates for domain.com and *.domain.com

If "secure": is set to false it works and previews.

Domains tested on: https://valorant.dev and https://files.mango.sd. (both are set to public)

Tested with Ubuntu 16.04 and 20.04.

If this is an error on the ShareX Upload Server side it would be wonderful if it could be fixed.

Edit: example config (currently the one from https://valorant.dev Edit2: Neither Nginx nor Apache are running on those servers, its just the ShareX Server

{
  "key": [""],
  "domain": "valorant.dev",
  "puploadKeyGenLength": 64,
  "public": true,
  "maxUploadSize": 50,
  "markdown": true,
  "port": 80,
  "secure": true,
  "fileNameLength": 4,
  "shortUrlLength": 3,
  "securePort": 443,
  "ratelimit": 1000,
  "dateURLPath": false,
  "allowed":[
    "png", "jpg", "gif", "mp4", "mp3", "jpeg", "tiff", "bmp", "ico", "psd", "eps", "raw", "cr2", "nef", "sr2", "orf", "svg", "wav", "webm", "aac", "flac", "ogg", "wma", "m4a", "gifv"
  ],
  "admin":{
    "key": ["admin pass key goes here"],
    "maxUploadSize": 1024,
    "allowed": [
    "png", "jpg", "gif", "mp4", "mp3","jpeg", "tiff", "bmp", "ico", "psd", "eps", "raw", "cr2", "nef", "sr2", "orf", "svg", "wav", "webm", "aac", "flac", "ogg", "wma", "m4a", "gifv", "html"
     ]
  },
  "paste": {
    "maxUploadSize": 20
  },
  "discordToken": "Discord Token Here (required if you want API monitoring through Discord)",
  "discordAdminIDs": ["discord IDs of people who can run commands go here", "Like this"],
  "discordChannelID": "the channel you're trying to send api monitor updates to",
  "prefix": "enter prefix for bot commands here"
}

mangosd1337 avatar Aug 14 '20 14:08 mangosd1337

Discord could definitely be doing some weird stuff. If it stopped how things previewed on multiple different services I'd begin to think that its a ShareS issue, but other services and your web browser can clearly get the image data. Discord should have no problem getting this data so this is an issue with them

TannerReynolds avatar Aug 15 '20 05:08 TannerReynolds

If you could supply me an example link to an image that doesnt preview, I could try to get this resolved with Discord

TannerReynolds avatar Aug 15 '20 05:08 TannerReynolds

Absolutely, one moment. https://files.mango.sd/2020/08/15/hBPw The picture above previews in Skype, Telegram and on Twitter. Not in discord tho.

A friend (who knows way more about JS stuff than i do) was looking at it and couldnt really find any issue.

I have now set up my second domain https://valorant.dev/ using Nginx as a Reverse Proxy and now it previews on this domain. It seems to be an issue related to the https package.

mangosd1337 avatar Aug 15 '20 06:08 mangosd1337

Hi, did Discord respond yet?

mangosd1337 avatar Aug 17 '20 01:08 mangosd1337

As far as I can tell from experience, Discord does some weird stuff with it. When using Cloudflare it works perfectly fine but if I setup my DNS Through my website provider, Discord fails to display. Could potentially be due to IP Reputation as well.

TheCuteFoxxy avatar Oct 07 '20 22:10 TheCuteFoxxy

Im having similar issues. I am running this in unsecure (http) and then using a cloudflare certificate and nginx reverse proxy to have https routes to my sharex uploader. I can go through to it fine in https and view the image fine however, in discord it dosent embed. I tried editing the code to make sure the protocol for sharex was https so that there wernt any redirects however, it still didnt embed. Even with .png on the end,

Nuckerr avatar Sep 01 '21 17:09 Nuckerr

@Nuckerr Does cloudflare handle your DNS for your domain?

TheCuteFoxxy avatar Sep 01 '21 21:09 TheCuteFoxxy

@Nuckerr Does cloudflare handle your DNS for your domain?

Yes, and the ssl certificates

Nuckerr avatar Sep 02 '21 07:09 Nuckerr

This would be a sharex thing. As my SC no longer works either. I put the link it generates into a browser and it no longer loads the page to show me my SC anymore. Not sure if there is a fix for this.

NightwalkerLots avatar Oct 12 '22 20:10 NightwalkerLots