Avatar uploads broken on subfolder installs?

I’m having the same issue on a newly-installed forum running the latest and greatest version. The progress bar gets to the end of the upload then shows this message:


What file format is the image? Is it mislabled as a JPG when it is actually something weirder like a BMP? I’ve seen this happen for image files that were the wrong type.

1 Like

I was able to test this using the Boing Boing hosted Discourse instance.

The avatar image will work there, However, the same image will not work on the hairtell.com/forum instance (running v2.2.0.beta3 +123).

Other asset uploads work fine, and no SSO overrides are enabled (nor anything fun like S3).

1 Like

Does it work on try.discourse.org?

It never hurts to upgrade to latest, and there have been some docker image updates so I’d do that using the standard command line 3-liner as well.

1 Like


Yep, v2.2.0.beta3 +123 is latest. I rebuilt the container just-in-case. Same issue. I’m going to bet it’s a subdirectory issue specifically since that’s probably the only significant difference. I’d claim local install config issue except uploading images works without issue (that and I’ve followed the official subdomain install instructions as well, vetted by @pfaffman no less).

BTW, when looking for this infamous Discourse 3-liner, I wasn’t able to find it in the Install guides, and most of the references to on google were actually references to @codinghorror asking people to use it (rather than defining what it is), so for anyone googling:

When @codinghorror refers to the “standard command 3-liner”, to the best of my knowledge, he means:

cd /var discourse
git pull
./launcher rebuild app

(or the name of your container config)


1 Like

Errr, no it isn’t. 2.2.0 beta3 +148 is latest at the moment.

Indeed. Updated to latest, same issue.

1 Like

We should ask @neil – is there anything in this Digital Ocean install that could have been forgotten that would make this fail to work?

Are you using amazon s3? There have been many changes in this area from @gerhard lately.

It’s an AWS install. ELB Fronted. No S3. As I said, image uploads and asset uploads via the setup wizard work fine.

Sadly, no error logs for the upload attempts. I’ll dig at system logs tomorrow to see if there’s anything in the web logs.

This is the picture I am trying to upload:


I believe it’s a run of the mill jpg with the .jpeg extension. It loads fine into posts, just not as an avatar.

Same thing happens when I convert it to .png. The upload gets to 100% then gives the error message previously posted.

Can you make it your avatar here?

1 Like

Smoking gun!

Found a reference in the weblogs to POST /uploads.json. Since this is a subdomain install, it should be /forum/uploads.json.

For reference, here are the existing app.yml changes that may be relevant, and are based off of posts here for ip headers and Docker Subfolder support:


(<ip> replaced below)

    # This is the magic to get IP numbers transmitted to Discourse
    - replace:
        filename: /etc/nginx/conf.d/discourse.conf
        from: "types {"
        to: |
          set_real_ip_from <ip>;
          set_real_ip_from <ip>;
          real_ip_header X-Forwarded-For;
          real_ip_recursive on;
          types {
  ## Settings to run from subfolder
  - exec:
      cd: $home
        - mkdir -p public/forum
        - cd public/forum && ln -s ../uploads && ln -s ../backups
  - replace:
     global: true
     filename: /etc/nginx/conf.d/discourse.conf
     from: proxy_pass http://discourse;
     to: |
        rewrite ^/(.*)$ /forum/$1 break;
        proxy_pass http://discourse;
  - replace:
     filename: /etc/nginx/conf.d/discourse.conf
     from: etag off;
     to: |
        etag off;
        location /forum {
           rewrite ^/forum/?(.*)$ /$1;

My guess is that the specific avatar upload isn’t honouring DISCOURSE_RELATIVE_URL_ROOT.


I’m unclear… this was not already set in your app.yml? If so that’s a broken install.

Yes! I uploaded the png. I then successfully changed it out for the jpg next.

1 Like

I’ve listed the app.yml changes that already exist for reference above, since it is difficult to troubleshoot the install without knowing how the install differs from a base install.

With the listed changes already in the app.yml, the avatar upload attempts a POST to /uploads.json, instead of /forum/uploads.json. This is not the expected result, because DISCOURSE_RELATIVE_URL_ROOT is set to /forum.

Is that more clear?


I have not had a chance to look at this @gerhard can you look at this first thing today.


Uploads were broken for subfolder installs.
I fixed it in FIX: Uploads didn't work for subfolder anymore · discourse/discourse@733b8af · GitHub


Confirmed as working now, thanks!