Avatar uploads broken on subfolder installs?

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:

DISCOURSE_RELATIVE_URL_ROOT: /forum

(<ip> replaced below)

  after_bundle_exec:
    # 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 {
run:
  ## Settings to run from subfolder
  - exec:
      cd: $home
      cmd:
        - 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.

5 Likes