How to Add a Proxy Smoke Test to GitHub Actions
Published
Choose a health endpoint you control
Use a manual workflow to check whether a GitHub Actions runner can reach an approved HTTP proxy and open an HTTPS connection through it. Pick a small health endpoint on a service you own. A healthy response such as 204 No Content makes the check easy to read. Replace https://app.example/health in the workflow with that fixed URL before committing the file.
Keep the workflow in a trusted repository and run it from a branch you have reviewed. The job runs curl directly and needs no repository checkout. The URL is part of the workflow, and the manual run button takes no inputs.
Add the proxy settings as Actions secrets
In the repository, open Settings → Secrets and variables → Actions. Under Secrets, choose New repository secret for each value you need. GitHub’s guide to Actions secrets.
- Set
PROXY_URLto the approved HTTP proxy address with an explicit port, such ashttp://proxy.example:3128. Enter just the scheme, host and port. - For HTTP Basic proxy authentication, set
PROXY_USERNAMEandPROXY_PASSWORDas separate secrets. Enter them as supplied by the proxy operator. Basic authentication requires a username without a colon. - For a proxy authorized by source IP, leave both credential secrets unset. The job can use the runner’s approved egress IP to connect. How IP allowlisting and proxy credentials work.
The HTTPS destination still gets TLS verification when curl opens a CONNECT tunnel through an HTTP proxy. The runner’s connection to the HTTP proxy itself is unencrypted, so use a trusted network path for this setup, especially when it carries Basic proxy credentials. HTTP and HTTPS proxy connections explained.
Add and run the workflow
Save the following as .github/workflows/proxy-smoke-test.yml. The example uses curl 8.3 or later to read secret values directly from the step’s environment. GitHub’s Ubuntu 24.04 image includes a compatible curl. Ubuntu 24.04 runner image inventory.
name: Proxy smoke test
on: workflow_dispatch
permissions: {}
jobs:
proxy-smoke-test:
runs-on: ubuntu-24.04
timeout-minutes: 2
steps:
- name: Check the health endpoint through the proxy
shell: bash
env:
PROXY_URL: ${{ secrets.PROXY_URL }}
PROXY_USERNAME: ${{ secrets.PROXY_USERNAME }}
PROXY_PASSWORD: ${{ secrets.PROXY_PASSWORD }}
run: |
set +x
proxy_pattern='^http://([A-Za-z0-9.-]+|\[[0-9A-Fa-f:.]+\]):[0-9]{1,5}$'
if [[ ! "${PROXY_URL:-}" =~ $proxy_pattern ]]; then
printf '%s\n' 'Set PROXY_URL to an HTTP proxy host and port.' >&2
exit 1
fi
auth=()
if [[ -n "${PROXY_USERNAME:-}" || -n "${PROXY_PASSWORD:-}" ]]; then
if [[ -z "${PROXY_USERNAME:-}" || -z "${PROXY_PASSWORD:-}" || "$PROXY_USERNAME" == *:* ]]; then
printf '%s\n' 'Set both proxy credentials and use a username without a colon.' >&2
exit 1
fi
auth=(--proxy-basic --variable '%PROXY_USERNAME' --variable '%PROXY_PASSWORD'
--expand-proxy-user '{{PROXY_USERNAME}}:{{PROXY_PASSWORD}}')
fi
curl_exit=0
codes="$(curl --disable --silent --globoff --http1.1 \
--proto '=https' --noproxy '' --connect-timeout 5 --max-time 12 --retry 0 \
--variable '%PROXY_URL' --expand-proxy '{{PROXY_URL}}' "${auth[@]}" \
--output /dev/null --write-out '%{http_connect} %{http_code}' \
--url 'https://app.example/health' 2>/dev/null)" || curl_exit=$?
read -r connect_code target_code <<< "$codes"
printf 'curl exit=%s | proxy CONNECT=%s | target HTTP=%s\n' \
"$curl_exit" "${connect_code:-000}" "${target_code:-000}"
[[ "$curl_exit" -eq 0 && "$connect_code" == 2[0-9][0-9] && "$target_code" == 2[0-9][0-9] ]]
Commit the workflow to the default branch. Open Actions, select Proxy smoke test and click Run workflow for your reviewed branch. Open the job log to see the status line. GitHub requires repository write access to dispatch the workflow. GitHub’s manual workflow instructions.
Each run makes at most one GET attempt through the configured proxy. The command uses a five-second connection limit and a 12-second total limit, with retries and redirect following disabled. It forces the proxy even if the runner has a matching NO_PROXY rule. The log gets status codes and a numeric exit code. The response body and curl’s error text are discarded, and the proxy settings stay out of the command arguments. curl command-line options and status fields.
Read the CONNECT status before the target status
curl exit=0 | proxy CONNECT=200 | target HTTP=204
The job passes when curl exits successfully and both HTTP statuses are in the 2xx range. The CONNECT status comes from the proxy’s response to the tunnel request. The target status comes from the HTTPS request inside that tunnel. A 000 means curl recorded no HTTP status at that stage.
| Job log | What to check |
|---|---|
CONNECT 407 | Confirm the proxy’s authentication method and the two Actions secrets. Troubleshoot HTTP 407. |
CONNECT 403 | Check whether the proxy accepts the runner’s source IP and permits CONNECT to the health endpoint’s host and port. |
CONNECT 000 with curl exit 5, 7 or 28 | Check proxy DNS, TCP reachability and timeouts from the runner. Read curl’s proxy error codes. |
CONNECT 200, target 000 and curl exit 60 | Check the destination hostname, certificate chain and runner trust store. Keep certificate verification enabled. Diagnose a TLS certificate error. |
CONNECT 200 with a target 3xx, 4xx or 5xx | Check the URL, access rules and application health at the destination. If the endpoint redirects, use the final HTTPS health URL you own. Test a proxy against a specific website. |
Match the allowlists to the runner and proxy
The runner must resolve the proxy hostname and reach its listening port. If the proxy uses an allowlist, add the runner’s outbound IP as seen by the proxy. The source IP you use from your laptop can differ, and standard GitHub-hosted runners do not give your repository a fixed outbound IP. If the proxy is on a private network or requires a stable source address, use a runner with approved network access and stable egress. A GitHub larger runner with static IPs or a self-hosted runner on your network can provide that route. Set runs-on to the label for that runner. GitHub-hosted runner IP guidance.
If the health endpoint also restricts incoming traffic, its allowlist needs to cover the proxy’s outbound address. Check the destination’s access logs after a successful run if you need to verify which address it saw.