[Guide] how to run peertube behind corporate proxy?

Hi,

I want to run peertube behind corporate proxy and according to production.yaml file I have found a section called trust_proxy where it has been mentioned that # If you run PeerTube behind a remote proxy, add the proxy IP address (or subnet) so based on that I tried to add the proxy url in that field but I am not able to run peertube behind the proxy.
I am not sure where to add the proxy.

Thanks in advance

Hello,

This setting is for admins that use a webserver (nginx for example) on a remote server so peertube correctly detects the client IP instead of the remote server IP.

Running peertube behind a corporate proxy for out network is not supported yet: Support proxies for HTTP requests used by PeerTube · Issue #4202 · Chocobozzz/PeerTube · GitHub

@Chocobozzz
I am trying to make PeerTube v3.2.x support proxies for HTTP requests as stated in Support proxies for HTTP requests used by PeerTube · Issue #4202 · Chocobozzz/PeerTube · GitHub.
PeerTube v3.2.x is using npm GOT package for http request. According to documentation, GOT pacakage is using hpagent and tunnel for proxy support. So, I installed hpagent package in our PeerTube environment.
I found that the got package is being used inside servers>helpers>requests.ts. So, the following code is added:-
const { HttpsProxyAgent } = require(‹ hpagent ›)
const peertubeGot = got.extend({
agent: {
https: new HttpsProxyAgent({
keepAlive: true,
keepAliveMsecs: 1000,
maxSockets: 256,
maxFreeSockets: 256,
scheduling: ‹ lifo ›,
proxy: ‹ http://<Proxy_IP:Port> ›
})
},
headers: {
‹ user-agent ›: getUserAgent()
},

I have implemented this in local system and the IP allowed in proxy server are given access to make a request from GOT package.

Other then allowed IP are not allowed to make requests.

And I am trying to implement the same idea in production environment.
I am not sure how to approach this problem. I believe some insights from the community would be helpful to point me if I am in right direction.

You can’t assume that all queries are going through the got package.
For example, «youtube-dl» makes requests too.
Plugins can make request without got.
Etc.

Also, please note that Peertube is a federated service. If you are using federation (and redundancy) features, your server should be accessible from the internet.

@JohnLivingston && @Chocobozzz … Does the new PeerTube 3.3.0 reads from environment variable like http_proxy & https_proxy?

@Chocobozzz & @JohnLivingston … I am trying to solve this issue related to Support proxies for HTTP requests used by PeerTube · Issue #4202 · Chocobozzz/PeerTube · GitHub. I would like to know how can i contribute to the PeerTube project. Also, i am using hpagent service to resolve the proxy server issue and i would like to know where PeerTube is using the request to do so.

@JohnLivingston & @Chocobozzz I have used the above code for my production environment and that seems to work as expected. Now, i would like to ask if reading the proxy from environment variables is best or reading from a config file? Just an opinion which one is better suited !!