Skip to content

[FR] HTTP Proxy Configuration #751

Closed

Description

@philippe-granet

In many enterprise environments, internet access to external services may need to be routed through HTTP/HTTPS proxies for security and monitoring. This requires applications to be aware of and use these proxies when making network requests.
Proxy settings are often provided via environment variables such as HTTP_PROXY, HTTPS_PROXY, and NO_PROXY.

But when I set these variables to access our Gitlab server through our proxy server, Sourcebot generate this error:

[backend] | 2026-01-16T21:14:13.021Z �[31merror�[39m: [gitlab] Failed to fetch projects for group my-group. fetch failed
[backend] | TypeError: fetch failed
[backend] |     at node:internal/deps/undici/undici:13392:13
[backend] |     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[backend] |     at runNextTicks (node:internal/process/task_queues:64:3)
[backend] |     at process.processImmediate (node:internal/timers:454:9)
[backend] |     at async defaultRequestHandler (file:///app/node_modules/@gitbeaker/rest/dist/index.mjs:67:22)
[backend] |     at async file:///app/node_modules/@gitbeaker/core/dist/index.mjs:99:22
[backend] |     at async fetchWithRetry (file:///app/packages/backend/dist/utils.js:69:20)
[backend] |     at async measure (file:///app/packages/backend/dist/utils.js:9:18)
[backend] |     at async file:///app/packages/backend/dist/gitlab.js:75:46
[backend] |     at async Promise.allSettled (index 0)

It would be great if we can use an HTTP Proxy with Sourcebot.

If it can help, Node.js supports HTTP_PROXY, HTTPS_PROXY, and NO_PROXY variables when NODE_USE_ENV_PROXY variable or --use-env-proxy CLI option is enabled. This works with node:http and node:https (v22.21.0 or v24.5.0+) methods as well as fetch() (v22.21.0 or v24.0.0+):
https://nodejs.org/en/learn/http/enterprise-network-configuration#proxy-configuration

Activity

  1. philippe-granet commented on Jan 16, 2026

    @philippe-granet
    Author

    With gitbeaker lib used to fetch Gitlab API in Sourcebot, it should be also possible to define an Agent:
    jdalrymple/gitbeaker#3716 (comment)
    e.g. something like:

    import { Gitlab } from "@gitbeaker/rest";
    import { HttpsProxyAgent } from 'https-proxy-agent';
    
    // HTTPS proxy
    const httpsProxy = new HttpsProxyAgent('http://proxy.company.com:8080');
    
    const gitlab = new Gitlab({
      token: 'your-token',
      host: 'https://gitlab.company.com',
      agent: httpsProxy 
    });
  2. msukkari commented on Jan 16, 2026

    @msukkari
    Contributor

    Thanks for raising @philippe-granet! Is this blocking your team from deploying Sourcebot?

  3. brendan-kellam commented on Jan 17, 2026

    @brendan-kellam
    Contributor

    If it can help, Node.js supports HTTP_PROXY, HTTPS_PROXY, and NO_PROXY variables when NODE_USE_ENV_PROXY variable or --use-env-proxy CLI option is enabled. This works with node:http and node:https (v22.21.0 or v24.5.0+) methods as well as fetch() (v22.21.0 or v24.0.0+):
    https://nodejs.org/en/learn/http/enterprise-network-configuration#proxy-configuration

    @philippe-granet could you try setting these environment vars on your Sourcebot instance? My guess is that it should just work, at least according to the nodejs docs.

  4. philippe-granet commented on Jan 17, 2026

    @philippe-granet
    Author

    It doesn't work because I use the Sourcebot Docker image ships with Node v20.18.1, while these variables requires Node >= v22.21.0 or v24.5.0+:

    FROM node:20-alpine3.19 AS node-alpine

  5. brendan-kellam commented on Jan 17, 2026

    @brendan-kellam
    Contributor

    hmm ok, I can look into upgrade node versions, shouldn't be a issue

  6. brendan-kellam commented on Jan 20, 2026

    @brendan-kellam
    Contributor

    @philippe-granet shipped the change in #753 - lmk if it works for you

  7. philippe-granet commented on Jan 23, 2026

    @philippe-granet
    Author

    @philippe-granet shipped the change in #753 - lmk if it works for you

    Yes it works, thanks a lot !

  8. added and removed
    enhancementNew feature or request
    on Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions