Could Onebox Support URL Retrieval via Proxy

AI-generated summary

The discussion revolves around enabling OneBox URL retrieval via a proxy in a tightly secured Discourse installation. Steven_Arnott explains the need for proxy support since their server cannot directly access external websites. downey notes that proxy issues may also affect Docker image updates. sam clarifies that proxy support isn’t built-in and would require a pull request. kpfleming suggests the HTTP/HTTPS library may support proxy configuration, which could be integrated into the container or admin settings. Steven_Arnott identifies relevant libraries like Net::HTTP, Nokogiri::HTML, and MultiJson, noting that http_proxy environment variables might work. jimbob confirms the issue persists, with proxy settings not being respected for OneBox, despite working for other actions. alexweej shares a similar problem and questions whether OneBox connects directly to external sites. SharonK asks if the upcoming v2 will address this. fzngagan references a related meta discussion for further context.

Our discourse installation is tightly locked down so it’s not possible for the OneBox to reach out from the server to an external website to provide a preview.

There is a proxy server that it go via. How can OneBox be told to retrieve the URL via a proxy host?

I don’t know the answer, but it sounds like you’ll also have trouble updating the Docker image through the admin UI, too.

You would need to submit a PR for this, there is no built in way of doing this, we assume servers have access to the Internet.

As I’m not a ruby coder, I would have no idea where to start on adding proxy support.

I suspect the underlying HTTP/HTTPS library being used has configuration options for proxy usage, it would mostly be a matter of figuring out what they are and then finding a good place to store them (in the container config, or through the admin interface, or some other place).

So far I see the following libraries:

Net::HTTP (Onebox.Helper.fetch_response)

Nokogiri::HTML (Onebox.Engine.HTML ‘raw’)

MultiJson.load (Onebox.Engine.JSON ‘raw’)

According to class Net::HTTP - Documentation for Ruby 2.0.0 http_proxy env should work

Apologies for necroing this old thread… I couldn’t find anything else on topic that is newer.
Did this get resolved? I’m in the same situation with a discourse instance that only has internet access via a proxy server.
My app.yml defines the necessary http_proxy and https_proxy env vars, and these are respected for some actions (e.g. during install) but not for onebox retrieval.

We’re also having the same problem. We have http_proxy, HTTP_PROXY, https_proxy and HTTPS_PROXY defined. As far as I know the proxy is allowing access to e.g. Twitter.

Does this onebox plugin need to talk to a specific web site or does it go directly to e.g. Twitter?

Does anyone know if v2 will resolve this?

Vale la pena echar un vistazo
https://meta.discourse.org/t/onebox-assistant-crawl-for-those-previews-reliably/107405/35