# Cannot load avatar images from particular sites

**URL:** https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003
**Category:** SSO
**Created:** [2017年九月29日 07:53 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003 "2017-09-29T07:53:47Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Konstantin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/konstantin/32/79659_2.png) [@Konstantin](https://meta.discourse.org/u/Konstantin)
#### Post date: [2017年九月29日 07:53 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/1 "2017-09-29T07:53:47Z")

</div>

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](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](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.

---

<div class="post-metadata">

### Author: ![Konstantin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/konstantin/32/79659_2.png) [@Konstantin](https://meta.discourse.org/u/Konstantin)
#### Post date: [2017年九月29日 07:54 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/2 "2017-09-29T07:54:22Z")

</div>

[http://f3.s.qip.ru/YtZ2dJIY.png](http://f3.s.qip.ru/YtZ2dJIY.png) - another not working sample

---

<div class="post-metadata">

### Author: ![Konstantin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/konstantin/32/79659_2.png) [@Konstantin](https://meta.discourse.org/u/Konstantin)
#### Post date: [2017年九月29日 07:55 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/3 "2017-09-29T07:55:47Z")

</div>

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

 ![](https://global.discourse-cdn.com/meta/original/3X/7/4/7456f07c575fa542b519555373bfbf114de0cab4.png)  
 ![](https://global.discourse-cdn.com/meta/original/3X/a/0/a03a26b86abadd90ca3f46012f9309200029ffb0.jpg)

---

<div class="post-metadata">

### Author: ![Dany](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dany/32/120447_2.png) [@Dany](https://meta.discourse.org/u/Dany)
#### Post date: [2017年十一月28日 20:31 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/4 "2017-11-28T20:31:23Z")

</div>

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 ?

---

<div class="post-metadata">

### Author: ![Konstantin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/konstantin/32/79659_2.png) [@Konstantin](https://meta.discourse.org/u/Konstantin)
#### Post date: [2017年十一月29日 04:56 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/5 "2017-11-29T04:56:52Z")

</div>

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](http://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](http://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](http://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)
?>

```

---

<div class="post-metadata">

### Author: ![Konstantin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/konstantin/32/79659_2.png) [@Konstantin](https://meta.discourse.org/u/Konstantin)
#### Post date: [2017年十一月29日 04:59 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/6 "2017-11-29T04:59:16Z")

</div>

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 🙂

---

<div class="post-metadata">

### Author: ![schungx](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schungx/32/70989_2.png) [@schungx](https://meta.discourse.org/u/schungx)
#### Post date: [2017年十一月29日 05:34 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/7 "2017-11-29T05:34:20Z")

</div>

SSO is used widely. I think IIS is used rarely! 😆

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

---

<div class="post-metadata">

### Author: ![Dany](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dany/32/120447_2.png) [@Dany](https://meta.discourse.org/u/Dany)
#### Post date: [2017年十一月30日 00:08 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/8 "2017-11-30T00:08:04Z")

</div>

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 - #5 by tgxworld](https://meta.discourse.org/t/sso-avatar-sync/74979/5)

---

<div class="post-metadata">

### Author: ![Dany](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dany/32/120447_2.png) [@Dany](https://meta.discourse.org/u/Dany)
#### Post date: [2017年十一月30日 21:23 UTC](https://meta.discourse.org/t/cannot-load-avatar-images-from-particular-sites/71003/9 "2017-11-30T21:23:27Z")

</div>

@Konstantin Here is the solution [SSO avatar sync not working due to incorrect HTTP HEAD response - #8 by Dany](https://meta.discourse.org/t/sso-avatar-sync/74979/8)
