# URLs for avatars & emoticons adding :80 to the end of the domain

**URL:** https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090
**Category:** Self-hosting
**Created:** [26 januari 2018 om 14:13 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090 "2018-01-26T14:13:38Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 14:13 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/1 "2018-01-26T14:13:38Z")

</div>

Guys,

I am having an issue where some avatars are missing where you’ve quoted someone in a post.

On investigating I noticed ‘:80’ being added to the end of each domain in the image URL for some avatars, but not others. When I copied a failed image’s URL(which begins https://) into a new browser tab and removed the :80 the avatar loaded fine.

What is going wrong? Why is port 80 being used within the URL and how best to resolve this?

Interestingly when you go and edit your post, the images in the preview work fine - they are missing the ‘:80’.

Apologies for my lack of knowledge!

Thanks!

---

<div class="post-metadata">

### Author: ![mikechristopher](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mikechristopher/32/89135_2.png) [@mikechristopher](https://meta.discourse.org/u/mikechristopher)
#### Post date: [26 januari 2018 om 14:21 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/2 "2018-01-26T14:21:11Z")

</div>

what does your DISCOURSE\_HOSTNAME say in your app.yml file?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 14:26 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/3 "2018-01-26T14:26:11Z")

</div>

forgive me for maintaining privacy, but its basically: [www.mydomain.org](http://www.mydomain.org)

btw, I think Facebook logon has been broken since forcing https too … as its redirects seem to be using port 80 too …

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [26 januari 2018 om 18:05 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/4 "2018-01-26T18:05:15Z")

</div>

Do you have any sort of proxy in front of Discourse? NGINX or Apache perhaps?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 19:27 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/5 "2018-01-26T19:27:34Z")

</div>

> [@jomaxro](#):
>
> NGINX or Apache

NGINX is running …

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [26 januari 2018 om 19:28 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/6 "2018-01-26T19:28:59Z")

</div>

This is very likely caused by something in your NGINX config then. Check out [Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247) for more details.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 20:01 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/7 "2018-01-26T20:01:41Z")

</div>

Sorry, @jomaxro, I’m not very experienced, so please forgive me, but:

root@blah:/# ps waux | grep nginx

returns:

root 4252 0.0 0.0 4244 604 ? Ss 19:21 0:00 runsv nginx  
root 4257 0.0 0.1 82720 3476 ? S 19:21 0:00 nginx: master process /usr/sbin/nginx  
www-data 4271 0.3 0.2 84908 5176 ? S 19:21 0:07 nginx: worker process  
www-data 4272 0.3 0.2 84628 5620 ? S 19:21 0:07 nginx: worker process  
www-data 4273 0.0 0.0 82888 1908 ? S 19:21 0:00 nginx: cache manager process

But i’m only running the vanilla discourse install in a docker container.

I didn’t explicitly install nginx

Does that change anything?

---

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [26 januari 2018 om 20:04 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/8 "2018-01-26T20:04:32Z")

</div>

> [@merefield](#):
>
> Does that change anything?

Yes it does. Discourse runs NGINX inside the docker container, so that _might_ be what you’re seeing. That’s not my area of expertise, unfortunately, you’ll need to wait for someone else who can confirm if the NGINX you’re seeing is inside or outside the container.

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [26 januari 2018 om 21:54 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/9 "2018-01-26T21:54:28Z")

</div>

> [@merefield](#):
>
> On investigating I noticed ‘:80’ being added to the end of each domain in the image URL. When I copied a failed image’s URL into a new browser tab and removed the :80 the avatar loaded fine. So seems port 80 is being blocked?

Does the URL of a failing image start with http or https?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 21:56 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/10 "2018-01-26T21:56:24Z")

</div>

> [@schleifer](#):
>
> Does the URL of a failing image start with http or https?

https, but suffixed with :80 (which will clearly fail as https doesn’t use this port?)

e.g.: [https://www.mydomain.org:80/letter\_avatar\_proxy/v2/letter/b/f475e1/40.png](https://www.mydomain.org:80/letter_avatar_proxy/v2/letter/b/f475e1/40.png)

the word ‘proxy’ is interesting!

---

<div class="post-metadata">

### Author: ![schleifer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/schleifer/32/86416_2.png) [@schleifer](https://meta.discourse.org/u/schleifer)
#### Post date: [26 januari 2018 om 22:09 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/11 "2018-01-26T22:09:29Z")

</div>

> [@merefield](#):
>
> e.g.: [https://www.mydomain.org:80/letter\_avatar\_proxy/v2/letter/b/f475e1/40.png](https://www.mydomain.org:80/letter_avatar_proxy/v2/letter/b/f475e1/40.png)

That’s not a custom avatar URL. The default capital letters load from our CDN =\> [https://avatars.discourse.org/v2/letter/b/f475e1/40.png](https://avatars.discourse.org/v2/letter/b/f475e1/40.png)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 22:12 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/12 "2018-01-26T22:12:35Z")

</div>

> [@schleifer](#):
>
> That’s not a custom avatar URL

Quite correct, I’d initially assumed it was happening to custom avatars only, now it seems to be inconsistent. Updated issue title and detail accordingly, apologies.

Here’s an example of a user avatar failing:

[https://www.mydomain.org:80/user\_avatar/www.mydomain.org/username/40/615\_1.png](https://www.mydomain.org:80/user_avatar/www.mydomain.org/username/40/615_1.png)

The weird part is that some are rendering correctly, others have :80 added …

It’s seems a little bit like this resolved issue, but I do not have a port number in my DISCOURSE\_HOSTNAME setting:

> [@Avatar not found after updating to 1.4 beta because of port in URL](https://meta.discourse.org/t/avatar-not-found-after-updating-to-1-4-beta-because-of-port-in-url/29632):
>
> As you can see [here](http://cms.di.unipi.it:8000/) avatars are not loading after upgrading to 1.4 beta. [image] The avatar src seems to be: "/user\_avatar/cms.di.unipi.it:8000/wil93/120/6\_1.png", and it looks wrong (the domain is repeated).

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 23:10 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/13 "2018-01-26T23:10:38Z")

</div>

I did a bit more digging and the problem posts seemed to have been submitted around the time I switched force\_https … I’m guessing that’s the source of the problem. I’m going to try to do a remap of the posts.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [26 januari 2018 om 23:34 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/14 "2018-01-26T23:34:17Z")

</div>

Offending posts fixed with:

discourse remap [mydomain.org:80/](http://mydomain.org:80/) [mydomain.org/](http://mydomain.org/)

Having looked at the logs I’m convinced that the offending posts occurred during a time I switched force\_https off for a short while.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [27 januari 2018 om 09:40 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/15 "2018-01-27T09:40:50Z")

</div>

Oh dear this is still happening and affecting emoticons too! I can use the workaround above but something is still baking :80 into image URLs in the first place and I cannot keep running the workaround …

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [27 januari 2018 om 13:09 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/16 "2018-01-27T13:09:20Z")

</div>

What does `SiteSetting.port` return when you type it in the rails console?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [27 januari 2018 om 14:02 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/17 "2018-01-27T14:02:05Z")

</div>

That’s returning 80!:

root@blah-app:/var/www/discourse# rails c  
SiteSetting.port  
[1] pry(main)\> SiteSetting.port  
=\> “80”

Should I set this to 443 directly? How to keep that persistent after reboot or upgrade? Where is it getting that value from?

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [27 januari 2018 om 15:31 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/18 "2018-01-27T15:31:23Z")

</div>

You’ll need to set it to `nil` to fix it.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [27 januari 2018 om 16:39 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/19 "2018-01-27T16:39:01Z")

</div>

Thanks! Will try that and revert with status. Will I need to restart anything?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [28 januari 2018 om 23:51 UTC](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090/20 "2018-01-28T23:51:25Z")

</div>

This seems to be resolved and no restart was required. Thanks for your help guys!

[Next page](https://meta.discourse.org/t/urls-for-avatars-emoticons-adding-80-to-the-end-of-the-domain/79090.md?page=2)
