XF 2.1 Cannot change avatars - clicking existing avatar gives a 404 error

Overscan

Active member
On my forum, no-one can edit their avatars in the forum.

If you click on the existing avatar, it says "oops. We ran into some problems". Using Chrome developer tools I can see 404 error for URL:


Code:
 https://www.secretprojects.co.uk/account/avatar?_xfRequestUri=%2Faccount%2F&_xfWithData=1&_xfToken=1559808904%2C04f76f710609d3cb70a484c2f74bae89&_xfResponseType=json

I note that

Code:
https://xenforo.com/community/account/avatar

works and gives the avatar editing page

On my forum

Code:
https://www.secretprojects.co.uk/account/avatar

Gives a 404 error.

I don't really understand how this URL relates to scripts in Xenforo, so not sure what is wrong. Maybe nginx config?
 
Last edited:
Turned on 404 logging in nginx -

/mnt/volume_nyc1_01/sites/www.secretprojects.co.uk/html/account/avatar" failed (2: No such file or directory),

Its looking for a file that doesn't exist.
 
I have a guy cleverer than me looking at the issue; he just sent me this text

"I have replicated the problem on my own xF install. It is something to do with nginx/plesk config. Working on it."

If he sorts it out I'll let you know . (y)
 
xF Support ticket response

Hi James,

The issue will be with the Nginx rewrites / configuration then.

You would need your serveradmin/webhost to look into it accordingly.

Kind Regards

Jon
 
The nginx config I'm using is basically from the Xenforo manual. This is the magic line:

try_files $uri $uri/ /index.php?$uri&$args;

If the URI doesn't work directly, try it with a slash, if neither of those work, try sticking index.php? in front of it and appending arguments supplied at the end.

However, this redirect works fine for ALL urls on the site EXCEPT this one. This implies something different is happening here.
 
I can confirm I am using

try_files $uri $uri/ /index.php?$uri&$args;

On an nginx config and it is working fine, are you adding these rewrites in the plesk options? I wonder if they are doing something weird that doesnt show up on a stock nginx install.
 
No plex here, stock install of nginx on Ubuntu 18.04. I wonder if this is an actual bug in my nginx version. Pretty sure I tested avatars at some point previously.

nginx/1.14.0 (Ubuntu 18.04)
 
So - fixed with a ugly workaround in nginx.

Add this line to nginx:

Code:
        rewrite ^/account/avatar /index.php?account/avatar;

This will redirect the URL without a slash which fails to redirect to the correct location. This seems to be a bug somewhere in our specific nginx/php/xenforo combination.
 
Last edited:
Yeah, we've had some rough times :D But it works since a couple of years now. Starting to get performance issues running PHP CGI under IIS, but all in all... :)
 
My own ugly work-around (also running on nginx) was to change the following templates, from /account/avatar to /account/avatar/ (with trailing slash)

1574257843724.webp
 
Top Bottom