Cannot load avatar images from particular sites

Hello.

Sory for bad english, it’s not native for me )
I’ve installed discourse for my project - it’s incredible!!!
All works fine, except load avatars by SSO from IIS server - yes it is sound strange, but fact!

For examle http://f6.s.qip.ru/YtZ2dJIW.png - works well! (not IIS server)
But from my IIS (and another IIS) - avatar doesn’t change, and there is no error in logs.
http://f6.s.qip.ru/YtZ2dJIX.png 2 different servers.(second url in next post, i cannot post more 2 links - i’m new)

SSO work’s fine, except avatars from IIS.
Can you suggest me something to cure this strange things.

wget from discourse-forum server download all images.

1 Like

http://f3.s.qip.ru/YtZ2dJIY.png - another not working sample

2 sample links on ordinary images from IIS (doesn’t work in sso’s avatar image)


hi @Konstantin, i have a similar problem. Some image are accepted and some not depending of the host and only the host. Did you find any solution to that strange behaviour ?

Hello @Dany !
No, nobody from Discourse developers answered ((
i’ve found out that problem only with IIS Web-servers.
I’ve made for such images url through nginx-proxy

I pass url on avatar for sso-request in such way:
"http://special-site-for-avatar-proxying.ru/special_url_files/" + real avatar path without domain name

Example (nginx proxy - special-site-for-avatar-proxying.ru):

   location /special_url_files {

            proxy_pass http://primary-site-with-avatar.ru;
            proxy_set_header Host $http_host;
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            }

    }

where special-site-for-avatar-proxying.ru - linux server with nginx, which proxying avatar(because from nginx the same image Discourse load successfully)
and primary-site-with-avatar.ru - primary site on iis, from which Discourse cannot load image

I already had nginx with proxying some content from the primary site, therefore it was easier for me use nginx.

But you can make the same proxying, for examplewith php script such this:

May be need to add some image headers, identificated mime type, it’s written only for example.

<?php
$url = $_GET["url"];
$url = urlencode($url);
$url = str_replace('%2F', '/', $url);
$url = str_replace('%3A', ':', $url);

echo file_get_contents($url)
?>

Of course it’s not solution, but i’m not ruby developer (i’m .net developer) and cannot fix the bug myself.
But solution with proxying through nginx/apache (for IIS avatars destination) works well.

It’s strange, that only you and i have such trouble… or may be just SSO used rather rarely :slight_smile:

1 Like

SSO is used widely. I think IIS is used rarely! :laughing:

It must have been some http fields that IIS serve that is tripping up Discourse into not accepting it.

Nginx / IIS is not the problem because i had the exact same problem on Nginx and on Jetty (java server). There is something else very weired that has to be solved. I opened a ticket you should follow : SSO avatar sync not working due to incorrect HTTP HEAD response

@Konstantin Here is the solution SSO avatar sync not working due to incorrect HTTP HEAD response