Skip to content

Codex Desktop App Proxy Without a Global Proxy

Set HTTPS_PROXY for the Codex process only, restart it, then check the exit.

What Codex reads

What Codex reads
ItemUsed forNotes
HTTPS_PROXYHTTPS requests first, then secure WebSocketThe main one to set. Use an http:// address.
HTTP_PROXYSecure WebSocket after HTTPS_PROXYSet it to the same value.
ALL_PROXYFallback for bothOptional if the two above are set.
NO_PROXYHosts that skip the proxyUse localhost,127.0.0.1.

Codex source (outbound_proxy.rs), read 13 November 2026. The same code marks socks, socks4 and socks5 addresses as unsupported.

Why this does not need a global proxy

A variable only reaches the program that is started with it. The browser, the package manager and every other app keep using your normal connection. That is the whole point: the proxy belongs to Codex, not to the computer.

The Codex source says that, when system proxy discovery is switched on, it is tried first and the environment variables are the fallback. If you have no system proxy configured, the variables are what counts.

macOS: start the app with the variables

export HTTPS_PROXY="http://LOGIN:PASSWORD@HOST:2222"
export HTTP_PROXY="$HTTPS_PROXY"
export NO_PROXY="localhost,127.0.0.1"

# Quit the app first, then start it from this same terminal window
open -a "APP NAME" --env HTTPS_PROXY --env HTTP_PROXY --env NO_PROXY

Example only. Replace LOGIN, PASSWORD and HOST with the values from My assets, and APP NAME with the app's name in your Applications folder.

Why you start it from the terminal

An app opened from the Dock or Finder does not read the variables you exported in a terminal. The macOS open command has an --env option that adds a variable to the environment of the application it launches, so open is a clean way to start Codex with the proxy and without touching the rest of the system.

If the app is already running, quit it fully first. A running app keeps the environment it started with.

Windows: set user variables

setx HTTPS_PROXY "http://LOGIN:PASSWORD@HOST:2222"
setx HTTP_PROXY "http://LOGIN:PASSWORD@HOST:2222"
setx NO_PROXY "localhost,127.0.0.1"

Example only. Replace LOGIN, PASSWORD and HOST. These are user variables, so every program you start afterwards can see them.

Windows: restart the app completely

setx writes the variables to the registry. They are available in programs started afterwards, not in windows that are already open, so close Codex fully (check the system tray and Task Manager) and open it again. If it still does not see them, sign out of Windows and in again.

The variables apply to every program you start from then on, but only Codex and tools that read the same variables will use them. To remove them later, delete the three variables in the system environment settings.

The VS Code extension

The extension runs inside VS Code, and VS Code passes its own environment to the processes it starts. So set the variables before VS Code starts: on macOS and Linux run code . from a terminal where they are exported, on Windows use setx and restart VS Code.

If the variables are set after VS Code is open, quit VS Code fully and open it again.

If your IP is SOCKS5

Codex does not accept socks5 addresses. A static IP on Proxy302 is issued with one protocol, and a per-IP lease also connects over the other protocol on that protocol's port, so the simple fix is the HTTP address on port 2222 with the same login.

If you want to keep the SOCKS5 address, run a local forwarder on your own computer and give Codex its http://127.0.0.1 address. The guide below has the commands.

Local forwarder example

gost -L http://127.0.0.1:8080 -F socks5://LOGIN:PASSWORD@HOST:3333

# then, in the terminal or variables that start Codex:
HTTPS_PROXY=http://127.0.0.1:8080

Example only. Keep the forwarder on 127.0.0.1 and replace HOST, LOGIN and PASSWORD.

Set it up with a Proxy302 IP

  1. Step 1

    Buy a static ISP IP with the HTTP protocol, in the country that matches your account. Open My assets and copy host, port, username and password.

  2. Step 2

    Put them in HTTPS_PROXY as http://LOGIN:PASSWORD@HOST:2222. If the password has @ or :, percent-encode them (@ becomes %40).

  3. Step 3

    Quit Codex completely and start it with the variables, as in the macOS or Windows section above.

  4. Step 4

    Run the check below in the same terminal. The country should be the one you bought.

    Expected result ipinfo.io shows the proxy's IP, not yours.

Check the exit

curl -x "$HTTPS_PROXY" https://ipinfo.io/json

Example only. It proves the proxy address and login work; then watch whether Codex stops reconnecting.

What a proxy does not change

A proxy changes the network address a service sees. It does not change which countries OpenAI supports, and OpenAI's page on supported countries says that accessing the services outside the listed countries and territories may result in the account being blocked or suspended. Use an IP in a country on that list, matching where you really are.

If Codex still does not use the proxy

The app keeps reconnecting

Check Was Codex started after the variables were set? Is the address an http:// one?

Fix Quit fully and start it again from the terminal; replace any socks5:// address with the HTTP one.

407 Proxy Authentication Required

Check The username or password is wrong, or has special characters.

Fix Copy them again from My assets and percent-encode @ and : in the URL.

The curl check works but the app does not

Check The app may have been started before the variables existed.

Fix Close every Codex window and process, then start it again with the variables.

Stop when If curl also fails, the problem is the IP or lease. Send the order number to Support.

FAQ

Does Codex have a proxy setting I can fill in?

Its source reads proxy variables from the environment, so that is the method this page uses.

Can Codex use a SOCKS5 proxy?

No. The Codex source marks socks, socks4 and socks5 addresses as unsupported; use an HTTP address.

Do the variables affect my other programs?

Only programs started with them, and only those that read proxy variables. Your browser and other apps are not changed.

Why must I quit and restart Codex?

A running program keeps the environment it started with, so variables set later are not picked up.

Which Proxy302 IP fits Codex?

A static ISP IP with the HTTP protocol: it stays the same during the lease. Choose the country that matches your account.

Reference links

6
  1. Codex source: outbound_proxy.rs (openai/codex)

    Official documentation · Confirmed on:

    Read on 13 November 2026 (main branch): HTTPS requests use HTTPS_PROXY, then ALL_PROXY; secure WebSocket uses HTTPS_PROXY, HTTP_PROXY, then ALL_PROXY; NO_PROXY is read; socks, socks4 and socks5 schemes are marked unsupported; the file header says system proxy discovery is tried first when enabled and environment variables are the fallback.

  2. macOS open(1) manual page

    Local example · Confirmed on:

    Read on 13 November 2026: open --env NAME=VALUE adds a variable to the environment of the launched application.

  3. Microsoft Learn: setx

    Official documentation · Confirmed on:

    Read on 13 November 2026: setx writes variables to the registry; they are available in future command windows only, not the current one.

  4. OpenAI: supported countries and territories

    Official documentation · Confirmed on:

    Read on 13 November 2026: accessing or offering access to the services outside the listed countries and territories may result in the account being blocked or suspended.

  5. gost documentation (go-gost/docs)

    Official documentation · Confirmed on:

    Read on 13 November 2026: -L sets the local listener and -F the next hop; credentials go in the URL as user:pass@.

  6. Proxy302 product facts and price list

    Product observation · Confirmed on:

    Product facts file of the site, checked 10 November 2026: HTTP port 2222 and SOCKS5 port 3333 on proxy.proxy302.com; each static IP is issued with one protocol; a per-IP lease also connects over the other protocol on that protocol's port; lease terms and prices.

Ready to try it?

Create an account, top up once, then pick rotating residential, static ISP or datacenter IPs and have one running in your browser within minutes.