Our discourse runs behind a proxy for outbound traffic.
We see that with “external system avatars enabled” selected the avatars are not loaded. Also the check for updates does not work.
We have set http_proxy and https_proxy. In the logging the message “Job exception: invalid address” is repeated.
How can we have outgoing requests working?
Configuration outbound proxy
Is this the letter avatars that is an issue or the uploaded avatars? Can you describe in detail how stuff is configured?
What’s the format of your http_ proxy variables? It has user and password inside?
We have no user and password, output from set | grep -i proxy
HTTPS_PROXY=http://<server>:<port>/
HTTP_PROXY=http://<server>:<port>/
NO_PROXY='127.0.0.1, localhost, <internal-network>'
http_proxy=http://<server>:<port>/
https_proxy=http://<server>:<port>/
no_proxy='127.0.0.1, localhost, <internal-network>'
A curl from within the container, which uses the proxy-settings:
curl -o /dev/null -v https://avatars.discourse.org/v2/letter/s/5f9b8f/45.png
results in: 200 OK
This is the letter avatars, but also the check for updates doesn’t work. It looks like all outgoing requests are failing.
We have a docker-host based on the standalone.yml. In the env:
section we added the proxy-settings. Attaching to the running container shows that the proxy-settings are correct.
Last time I had to work in an environment like this I found that Ruby is the worst language in this aspect, where most http methods don’t respect the proxy variables unless explicitly set, where java, python, node, php all work fine. /rant
You can try to emulate the version check with:
ssh root@your.server.here
cd /var/discourse
./launcher enter app
cd /var/www/discourse
rails c
puts Excon.send( :get, 'https://meta.discourse.org/latest.json', omit_default_port: true).body
## also
puts ENV ## does this prints your proxy info?
It works or fail? What’s the error message?
No errors, all output looks fine.
root@93ca6a8ec7a6-discourse:/var/www/discourse# rails c
[1] pry(main)> puts Excon.send( :get, 'https://meta.discourse.org/latest.json', omit_default_port: true).body
{"users":[{"id":1,"username":"sam","avatar_template":"/user_avatar/meta.discourse.org/sam/{size}/5243_1.png"},
... much more ...
Frequent Poster","user_id":1,"primary_group_id":47}]}]}}
=> nil
[2] pry(main)> ENV
...
"HTTPS_PROXY"=>"http://<server>:8082/",
"HTTP_PROXY"=>"http://<server>:8082/",
...
"NO_PROXY"=>
"127.0.0.1, localhost, <internal>",
...
"http_proxy"=>"http://<server>:8082/",
"https_proxy"=>"http://<server>:8082/",
"no_proxy"=>
"127.0.0.1, localhost, <internal>"}