Avatar Flair Image doesn't use S3 CDN

AI-generated summary

The issue is that Avatar Flair Images are being pulled directly from the upload bucket instead of the S3 CDN. dschaper has tried to update the domains to use the S3 CDN, but was unsuccessful. The issue was reproducible on Meta by Falco. dschaper suspects that a variable may be set incorrectly, but Falco has found a solution in the form of a pull request (#12130). The fix has been confirmed to be working by dschaper.

We’ve recently moved our file storage over to S3 using the wiki posted here on meta. Everything* looks like it’s now being pulled via our two CDNs. (One for static files and one for uploads as suggested in the wiki guide.)

  • We have images for two user group Avatar Flair Images and they are now being pulled directly from the upload bucket instead of from the S3 CDN like the other images. I don’t know what rails commands need to be run to update those domains to be the S3 CDN instead of the bucket directly.
1 Like

Not sure if Secure Media Uploads breaks Group flair image - #4 by Benjamin_D is related, will try to bootstrap a new image to check.

Still pulling directly from the bucket and not from the CDN using commit 4739bdac0a

1 Like

I can reproduce the same on Meta, taking a look.

3 Likes

It looks like I may have a variable set incorrectly:

data-s3-cdn="https://b2discourse.pi-hole.net" data-s3-base-url="//pi-hole-discourse.s3.us-west-001.backblazeb2.com">

From:

<meta id="data-discourse-setup" data-cdn="https://discourse-cdn.pi-hole.net" data-base-url="https://discourse.pi-hole.net" data-base-uri="" data-environment="production" data-letter-avatar-version="5_6363c49f2373467b0c1a609f08282e85" data-markdown-it-url="https://b2discourse.pi-hole.net/assets/markdown-it-bundle-04999a8c1ce5e0e2544244cf2303c4383d8aaae90f8446b875a9724470a9aca3.br.js" data-service-worker-url="service-worker-f303985b31c200485c2aa8e2cdf12f43c5ad579c27d72b781c23319094ff1c5e.js" data-default-locale="en" data-asset-version="23d26bd3e38bb68bf4439a677abf8c6a" data-disable-custom-css="false" data-highlight-js-path="/highlight-js/discourse.pi-hole.net/8bc3c58d47a0fcff6af9ab4ac94ae20259fa83c8.js" data-svg-sprite-path="/svg-sprite/discourse.pi-hole.net/svg-27-758bb98be0f3145e18faa8056ce0ec74ec37e41b.js" data-enable-js-error-reporting="true" data-color-scheme-is-dark="true" data-user-color-scheme-id="1" data-user-dark-scheme-id="-1" data-s3-cdn="https://b2discourse.pi-hole.net" data-s3-base-url="//pi-hole-discourse.s3.us-west-001.backblazeb2.com">

The only Base URL I can see in the Settings page is the long polling URL. That is currently set to /.

Would a new environment variable of DISCOURSE_S3_BASE_URL: https://b2discourse.pi-hole.net be a possible solution?

This is the current S3 setup:

  DISCOURSE_USE_S3: true
  DISCOURSE_S3_REGION: "us-west-001"
  DISCOURSE_S3_INSTALL_CORS_RULE: false
  DISCOURSE_S3_CONFIGURE_TOMBSTONE_POLICY: false
  DISCOURSE_S3_ENDPOINT: https://s3.us-west-001.backblazeb2.com
  DISCOURSE_S3_ACCESS_KEY_ID: REDACT
  DISCOURSE_S3_SECRET_ACCESS_KEY: REDACT
  DISCOURSE_S3_CDN_URL: https://b2discourse.pi-hole.net
  DISCOURSE_S3_BUCKET: pi-hole-discourse
1 Like

This pull request will fix it

https://github.com/discourse/discourse/pull/12130

4 Likes

Confirm the fix is working.

Screenshot 2021-02-18 122314

2 Likes

This topic was automatically closed after 14 hours. New replies are no longer allowed.