Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Outbound http and https requests from server to honor http_proxy env variables (oembed) #1194

Closed
jascott opened this issue Oct 21, 2015 · 14 comments

Comments

@jascott
Copy link

jascott commented Oct 21, 2015

After discussion in Rocket.Chat#support and some investigation, it was concluded that links to images and pages were not embedding in the chat channel because the http_proxy environment variables were not being honored.

The solution we discussed was to make oembed detect the http_proxy variables and use them if they exist.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Sing-Li
Copy link
Member

Sing-Li commented Oct 22, 2015

@Sing-Li Sing-Li changed the title oembed should honor http_proxy variables Outbound http and https requests from server should honor http_proxy env variables (oembed) Oct 22, 2015
@Sing-Li Sing-Li changed the title Outbound http and https requests from server should honor http_proxy env variables (oembed) Outbound http and https requests from server to honor http_proxy env variables (oembed) Oct 22, 2015
@kakawait
Copy link
Contributor

Duplicate #851 (consider closing one of them) where I explain other possible solutions

Apply proxy on http is pretty easy but on https is a bit harder

@luozengbin
Copy link

https://www.npmjs.com/package/global-tunnel is easy to fix this issue.
i just hack rocketchat_oembed.js with fllowing code.

$ diff rocketchat_oembed.js rocketchat_oembed.js.orgn
35,39d34
< globalTunnel = Npm.require('global-tunnel');
< globalTunnel.initialize(); // 1

@Mitsugaru
Copy link

@luozengbin can you elaborate on that? Have an instance of Rocket.Chat deployed from a docker container, just not sure where to put the two lines you mentioned...

@Sing-Li I get that handling deployments behind corporate proxies is probably a low priority... but perhaps could we have some proxy fields in the administration panel that it could then read and use for outbound connections?

@pwr22
Copy link

pwr22 commented Mar 15, 2016

Still present, any movement on this so far?

rodrigok added a commit that referenced this issue Mar 28, 2016
Fixes #1194: OEmbed http requests use "request" npm package
@wesbland
Copy link

This has been closed, but I'm still seeing the issue on the latest versions of Rocket.Chat. Is there some sort of advice/wiki page for setting up a regular proxy (not a reverse proxy) that isn't obvious?

@maxdwit
Copy link

maxdwit commented Jan 27, 2017

+1 have the same issue. Behind proxy I dont see any preview links

@sysr-q
Copy link

sysr-q commented Sep 6, 2018

Can confirm this is still an issue on 0.69.0 (unless I'm missing something obvious).
Behind a regular corporate proxy, there's no embeds.

@conman2305
Copy link

Seeing this issue as well on 0.69.1. Any updates? Should I open a new issue?

@sysr-q
Copy link

sysr-q commented Sep 11, 2018

For anyone who comes across this, I figured out a (partial) solution if you're running Rocket.Chat under Ubuntu Snaps.

From your Rocket.Chat server, run: sudo systemctl edit snap.rocketchat-server.rocketchat-server.service

Add the following contents:

[Service]
Environment=HTTP_PROXY=http://proxy.example.com:8080/
Environment=HTTPS_PROXY=http://proxy.example.com:8080/
Environment=NO_PROXY='something.example.com,*.intranet.example.com'

You can leave out the NO_PROXY line if you need, but at $EMPLOYER, we link intranet stuff so for Rocket.Chat to show previews for internal stuff that's required.

@pagnotta
Copy link

pagnotta commented Mar 14, 2019

There is also a solution for the "manual" Ubuntu install:

In the systemd unit file /lib/systemd/system/rocketchat.service you can set environment variables, I added HTTP_PROXY and HTTPS_PROXY there. Link preview works now.

[Unit]
Description=The Rocket.Chat server
After=network.target remote-fs.target nss-lookup.target nginx.target mongod.target
[Service]
ExecStart=/usr/local/bin/node /opt/Rocket.Chat/main.js
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=rocketchat
User=rocketchat
Environment=MONGO_URL=mongodb://localhost:27017/rocketchat ROOT_URL=https://<yourdomain>:3000/ PORT=3000 HTTP_PROXY=http://<yourproxyurl>:<PORT> HTTPS_PROXY=http://<yourproxyurl>:<PORT>
[Install]
WantedBy=multi-user.target

@magicbelette
Copy link
Contributor

Becarful if you set a HTTP(S)_PROXY it will be you use for everything, even for communication with other local Rocket.Chat instances. NO_PROXY is not read either. See #11484

@Abraka
Copy link

Abraka commented Mar 22, 2019

Agreed, HTTP(S)_PROXY its not a solution here. There should be a option under link preview option in rocket chat administration called "proxy settings for downloading external content". And thats it...see? Easy peasy.

@reetp
Copy link

reetp commented May 28, 2019

For more Proxy stuff see:
#2657

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests