How to Set Up OpenVPN Through an HTTP Proxy
OpenVPN can connect to a VPN server through an HTTP proxy instead of connecting directly. You'll need this when a direct connection is blocked, or when the VPN connection has to go out to the internet from the proxy's IP. Below is a step-by-step client setup.
What you'll need
- a working OpenVPN server and a client config file (
.ovpn); - an HTTP(S) proxy: address, port, username and password;
- OpenVPN client version 2.4 or later.
Step 1. Switch OpenVPN to TCP
An HTTP proxy only carries TCP connections. If your server and client run over UDP (which is the OpenVPN default), you won't be able to connect through an HTTP proxy.
In the server config:
proto tcp-server
In the client config:
proto tcp-client
proto tcp — OpenVPN will figure out the role on its own. What matters is that both the server and the client use TCP.Step 2. Add http-proxy to the client config
Open the client .ovpn file and add the following lines:
http-proxy 203.0.113.10 8080 auth.txt basic
connect-retry 5
connect-retry-max 0
Here's what each part does:
http-proxy— connect to the VPN server through an HTTP proxy;203.0.113.10and8080— your proxy's address and port (this is just a placeholder, use your own);auth.txt— the file with your proxy username and password;basic— the proxy authentication method;connect-retry 5andconnect-retry-max 0— retry the connection every 5 seconds with no limit on the number of attempts.
http-proxy-retry. This directive was removed in OpenVPN 2.4 — use connect-retry instead.Step 3. Create the authentication file
Next to your .ovpn file, create a text file named auth.txt. Put the proxy username on the first line and the password on the second:
proxyuser
proxypass
If the file is in a different folder, specify its full path in http-proxy. On Linux, restrict access to the file: chmod 600 auth.txt.
Step 4. Test the connection
- Start the client and open the log: you should see a line about connecting through the proxy (
Attempting to establish TCP connection with [AF_INET]proxy_address), followed byInitialization Sequence Completed. - Check your external IP on any IP lookup service.
- Open the resources you set up the VPN for.
Common errors
- The connection won't come up, UDP errors in the log — the client or the server is still on UDP; go back to step 1.
- HTTP 407 Proxy Authentication Required — wrong username or password, or OpenVPN couldn't find
auth.txt. - The proxy rejects the connection — the proxy doesn't allow connections to the required port. Try running the VPN server on port 443.
- You need SOCKS5, not HTTP — use the
socks-proxy address port auth.txtdirective.
LTEBoost mobile proxies support HTTP(S) and SOCKS5. Test the connection for free with a 2-hour trial in our Telegram bot.
