Skip to main content
In this guide, you’ll learn how to route your self-hosted GitHub Actions runner traffic through an HTTP/HTTPS proxy. A proxy server acts as an intermediary, forwarding requests between your runner and the Internet for improved security, privacy, or access to geo-restricted endpoints.
The image shows a GitHub documentation page about configuring a proxy server with self-hosted runners, including instructions on using environment variables.

Proxy Configuration Options

You can configure proxy settings for your self-hosted runner in two primary ways:

1. Environment Variables

On the machine hosting your runner, export:
NO_PROXY accepts comma-separated hostnames, IP addresses, or domains (optionally with ports).

2. .env File

If modifying system environment variables is impractical, create a .env file in the directory where you extracted the runner:

Docker Containers

For workflows that launch Docker containers, configure Docker’s proxy settings separately.
For example, create or edit /etc/systemd/system/docker.service.d/http-proxy.conf:
Then reload and restart Docker:

Demo: Proxy in a Workflow

The following sample workflow sends external HTTP requests with and without proxy authentication.
The image shows a GitHub Actions page for a repository named "enterprise-actions-demo" with a workflow titled "Exploring Github Enterprise Action Features/Policies." It displays a list of workflow runs with their statuses and details.

Logs: No Proxy

This request bypasses any proxy and connects directly.

Logs: Invalid Proxy Credentials

The image shows a GitHub Actions job log with an error message indicating an external call failed due to invalid proxy credentials.
Avoid hard-coding credentials in workflows. Instead, store proxy credentials securely on the runner host or via GitHub Secrets.

Setting Proxy Variables on the Runner Host

On your VM or bare-metal host, export the proxy variables before launching the runner service:
The image shows a GitHub documentation page about configuring a proxy server using environment variables for self-hosted runners. It includes examples of proxy URLs and a sidebar with navigation links related to GitHub Actions.
Restart the runner service so it picks up the new environment:

Verifying Proxy Usage in Your Workflow

Update your workflow to print proxy variables and make an HTTPS request:
The image shows a GitHub Actions interface with a completed workflow run named "demo_job," which includes steps like setting up the job, making an external call using cURL, and verifying proxy settings.
Once the run completes:
The image shows a GitHub Actions interface with a completed workflow run titled "Exploring Github Enterprise Action Features/Policies." The workflow includes steps like "Set up job," "Hello," "External Call using cURL," "Verify Proxy Settings," and "Complete job," all marked as successful.

Logs: Proxy in Action

The runner picks up the proxy variables automatically, authenticates with your proxy (e.g., Squid), and successfully forwards requests.
Thank you for following this tutorial on setting up proxies for your self-hosted GitHub Actions runners! For more details, see the GitHub Actions documentation.

Watch Video