Uploaded avatars and Gravatar not working with subfolder installation

(Sergei Petrunin) #1


I have a subfolder latest Discourse installation (use official how-to).

I have a Gravatar account and Discourse used to load my picture with subdomain (default) installation.
But when I made a clean new subfolder installation, Discourse no longer loads my Gravatar picture (I keep using same email).

No matter how many times I keep pressing on update button next to Gravatar.
You can check that on my email there is a Gravatar picture actually.

When I try to upload an avatar picture the following happens:
Firstly, picture uploaded, and displayed

But than, after page reload, picture fall back to silhouette of gray fellow.

You can reproduce this behavior on this site


(cpradio) #2

We’ve seen this recently at Sitepoint too, I didn’t have time to dig into it the other day, so we reverted the user’s avatar to the system one. We’re also a sub-folder install, so there may be something going on with gravatar and sub-folder installs.

1 Like

(Sergei Petrunin) #3

I check the site you mention, create a new user, and from what I see both Gravatar and Uploaded pictures wokred fine.
I wander, may be it’s because of my proxy nginx (in my case Discourse resides on a distant machine and requests to it proxied via nginx)?
Do you know how Discourse installation was done on sitepoint.com? Can you share insides of it?:slight_smile:


(cpradio) #4

It is hosted by the Discourse team and uses Fastly to handle sub-folder support. I simply know we’ve had several Gravatars come over as a 1x1 pixel as of late, so I wasn’t sure if it was related.


(Sergei Petrunin) #5

Seems your problem is a different issue.
Do you know what version of Discourse is using on Sitepoint (if it’s not the secret)?
I encounter my issue at version 1.5.0.beta8 (current latest). May be it worth to try 1.4.x without “.beta”?


(cpradio) #6

We’re on 1.5.0.beta6, I think.


(Sergei Petrunin) #7

I’ve installed version 1.5.0.beta6 on my local computer, and reproduce 1x1 pixel blank white avatars.

But my issue remains in beta6, when I ulpoad an image, URL to it changes from /social/en/user_avatar/nsr24.com/halfstrik/120/18_1.png to /social/en/uploads/default/original/1X/400760f62da08b00a8f359f41ff6f0d5d391faad.jpeg until I do not refresh the page.

After refresh image URL reverts to /social/en/user_avatar/nsr24.com/halfstrik/120/18_1.png witch happen to be blank 1x1 pixel.

Interesting thing is if I try to load my uploaded avatar, it’s working, so the real problem is with the link, not with the image file.


(Jeff Atwood) #8

You’ll need to be on latest before this can be considered a bug. Does it repro on latest?


(Sergei Petrunin) #9

Yes, I use latest version of Discourse (v1.5.0.beta8) and the issue occurs on it.

Just now I reproduced this issue on clean Discourse install following this guide and apply subfolder setup from this howto.

And Gravatar started to work and survive page reloads.
Does config for run: section actually correct, is it require 4 spaces before - exec?
But image uploads still failed to work…


(Sergei Petrunin) #10

Seems I finally find the root of the problem:

Subfolder setup assums only one subfolder, so installations like /forum or /community works and my variant /social/en - dose not works for avatars or Gravatar.

Now I change subfolder to be /social-en and Uploaded avatars and Gravatar now work!

I think the case with nested subfolders (like /forum/es and /forum/en) need to be documented (so folks will use /forum-en instead) or, better, fixed.

Thanks for the help!


(Jeff Atwood) #11

How should we handle this @neil?


(Neil Lalonde) #12

I suspect that those are bugs in our subfolder support. They can probably be fixed… I’ll have a look.

1 Like

(Neil Lalonde) #13

I just tested it and custom uploads and gravatar avatars are working on /forum/en for me. But they weren’t at first because I forgot to setup the proper sub-subfolder in public.

cd /var/www/discourse/public
mkdir -p forum/en
cd forum/en
ln -s ../../uploads

Maybe you forgot to do that too @Strikki_Strik?


(Sergei Petrunin) #14

I see, in my containers/app.yaml in - run section instead of this

`- mkdir -p public/forum/en

  • cd public/forum/en && ln -s …/uploads && ln -s …/backups`

I should do that:

`- mkdir -p public/forum/en

  • cd public/forum/en && ln -s …/…/uploads && ln -s …/…/backups`

Wait, I’ll check it, but it seems to do the trick!


(Sergei Petrunin) #15

Yep, it’s working like a charm!

That’s why I’m not a big fan of relative paths like ../../ … They easy for me to mess up… and hard to count ../'s.
But I failed to invent anything simpler with ln :frowning:

Thank you very much to point this out!:+1:

I think this thread may be closed


(Neil Lalonde) closed #16