50% OFF Residential Proxies for 9 months — use code IPR50 at checkout

Get The Deal

In This Article

Back to blog

How to Set Up Proxy on HarmonyOS (Step-by-Step Guide)

Integrations

Learn how to set up a proxy server from IPRoyal or other providers on HarmonyOS smart devices using our step-by-step guide you can follow now.

Simona Lamsodyte

Last updated - ‐ 7 min read

Key Takeaways

  • HarmonyOS doesn't have official support for proxy servers, but there are a few workarounds.

  • The easiest method is to set up a proxy server in Wi-Fi settings, but it will only affect the device when mobile data is turned off.

  • Enabling global proxy routing with a CLI tool might only be possible for older Huawei devices.

  • CLI tools and development environments can also use proxy servers to load packets and complete other tasks.

  • Some HarmonyOS devices can’t connect to a proxy server without sideloading apps or rooting the device to run Android.

HarmonyOS is an operating system used by Huawei devices - smartphones, tablets, smart TVs, watches, PCs, and other products. As with all smart devices, you can enhance their privacy, security, and access capabilities with a high-quality proxy server.

Unfortunately, configuring an HTTPS proxy server on HarmonyOS isn’t as straightforward as on Android or iOS. There are no separate proxy settings in the menu, so you’ll have to use one of the few proxy configuration workarounds. Some of them require tinkering with developer environments and CLI tools.

How to Set Up a Proxy on a HarmonyOS Device

If you’re looking for something similar to proxy server settings in Android or iOS, the closest alternative is editing your current Wi-Fi settings.

  • Press the ’Settings’ icon
  • Navigate to ’Wi-Fi settings’
  • Choose the Wi-Fi network you are currently using
  • Tap ’Modify’ (or ’Advanced settings’ )
  • Select ’Manual proxy configuration’
  • Enter the proxy hostname and port
  • Save and apply

Note that these steps apply only to some HarmonyOS smartphones and will enable an HTTPS proxy only for the Wi-Fi connection. You can connect through a mobile proxy , for example, when using a public Wi-Fi to increase security.

This method won’t work when you need to use mobile data on your device or when the proxy server requires authentication. In such cases, you need to set up a proxy server in the developer environment.

How to Configure a Proxy for CLI Tools

CLI (Command-Line Interface) tools allow running text-based commands in a terminal or console to control software. In the HarmonyOS environment, commands are used for package managers, two of which, NPM (Node Package Manager) and HPM (Harmony Package Manager), can help you create a CLI proxy setup.

Most often, CLI tools with datacenter proxies are used for application development - bypassing network restrictions, accessing registries, authenticating connections, testing, and other use cases. It isn’t what you would expect from a device-wide proxy server, as it won’t affect all everyday apps.

npm Proxy Configuration

There is no traditional CLI tool available for consumer-grade HarmonyOS devices. So, you’ll need to download the Integrated Development Environment (IDE) called DevEco Studio to your Windows, Mac, or Linux PC. Then, follow these steps:

  • Enable developer options by tapping on the build number seven times.
  • Enable USB debugging in developer options.
  • Connect the Huawei device via USB cable to the PC.
  • Open a terminal on your PC and run the following commands:
hdc devices # should list your phone
hdc shell # opens a shell on the phone
  • Older Huawei devices can run the following command for enabling a global proxy server, which applies to applications, like a web browser, as well.
hdc shell settings put global http_proxy HOST:PORT

This is equivalent to a global proxy adb command for Android, but it isn't stable on all devices, particularly those running Android 10 or later. Newer versions of HarmonyOS have inherited this architecture, so recent devices may not support this command.

If this is the case, you can only enter an NPM command to use a proxy server when loading packages.

If your proxy server requires authentication:

npm config set proxy http\://user:password@proxyserver:port
npm config set https-proxy http\://user:password@proxyserver:port

If your proxy server doesn't require authentication:

npm config set proxy http\://user:password@proxyserver:port
npm config set https-proxy http\://user:password@proxyserver:port

Now, the Node Package Manager commands you enter will be routed through a proxy server. The same can be done for the Harmony Package Manager. If this isn’t needed, you can close the terminal and unplug the device.

hpm Proxy Configuration (HarmonyOS Package Manager)

Since we already have DevEco Studio set up, we can simply run commands in the terminal window to set up the HPM proxy server.

If the proxy requires authentication:

hpm config set http_proxy http\://user:[email protected]:port
hpm config set https_proxy http\://user:[email protected]:port

If the proxy doesn't require authentication:

hpm config set http_proxy http\://proxy.server:port
hpm config set https_proxy http\://proxy.server:port

Testing Your CLI Proxy Setup

These commands affect only the Node Package Manager and Harmony Package Manager CLI tools. It's a good practice to verify the settings each time before using them.

For NPM:

npm config get proxy
npm config get https-proxy

For HPM:

hpm config get http_proxy
hpm config get https_proxy

If all is set correctly, these commands should return your proxy server URLs. If you only configured HTTPS proxy or HTTP proxy settings, one command is enough.

Further, we can test the proxy server connectivity by pinging it in NPM.

npm ping

If you see any errors, further troubleshooting is required. HPM doesn't have a ping function. So, the best way to test proxy server connectivity is to see if you can install a package.

hpm install <harmonyos-package-name>

Ready to set up your proxy on HarmonyOS?
Get Started

How to Set a Proxy in VS Code or IntelliJ for HarmonyOS

The NPM and HPM methods will work only in their respective CLI tools and some applications. If you are a HarmonyOS developer, it may be more convenient to connect through a proxy server from a different IDE.

Visual Studio Code Proxy Setup

  • Open Visual Studio Code on your PC.
  • Click on the ’Settings’ icon.
  • Search for ’Proxy’ settings or find them in the ’Application’ section.
  • Click on ’Add Item’ and enter your proxy credentials.
  • Restart Visual Studio Code and test your CLI proxy setup.

IntelliJ IDEA / Android Studio Proxy Setup

Since Android Studio is based on IntelliJ IDEA, the instructions for setting up proxies on both development environments are essentially the same.

  • Open IntelliJ IDEA or Android Studio.
  • Go to ’Plugins’ and click on the ’Settings’ icon.
  • Select ’HTTP Proxy’ settings.
  • Choose ’Manual proxy configuration.’
  • Specify your proxy type and enter your proxy credentials.
  • Set proxy exceptions if needed.
  • Test the proxy connection by clicking ’Check connection.’
  • Click ’OK’ and save.

Troubleshooting Common Proxy Issues on HarmonyOS

Since there is no official proxy support for Huawei devices running HarmonyOS, the workarounds you use will require different troubleshooting if issues occur. Generally, Proxy setups on CLI tools most often encounter two issues:

  • If the NPM of HPM doesn’t read system proxy settings, double-check whether the correct proxy type is configured.
  • If the IDE cannot fetch SDKs, the reason might be misconfigured proxy settings or a proxy location blocked. Some HarmonyOS SDKs might require an IP address from China.

When setting up a proxy server on HarmonyOS for apps like a web browser to connect through, different troubleshooting steps may apply when issues arise.

  • Check whether you are using your Wi-Fi connection if you have set up your proxy settings there.
  • Ensure that proxy authentication and other credentials are entered correctly.

Lastly, if none of the solutions work, consider sideloading a proxy app, such as ClashBox , which can allow you to set up a proxy server connection on HarmonyOS. However, such apps have limited support and compatibility. In many cases, the only option might be to install a version of Android that supports proxies.

Wrapping Up

If you want to avoid complicated proxy server integration steps that CLI tools require, your only option is to set up an HTTP proxy in the Wi-Fi settings. The steps for more complicated proxy authentication parameters might change in the future, so be sure to check the official HarmonyOS documentation .

In the end, the easiest way to connect to a proxy server on HarmonyOS is by sideloading apps support proxy implementation. Another option is rooting the device to install Android. Unfortunately, both options are likely to bring other complications.

FAQ

Can I use a proxy with mobile data on HarmonyOS?

HarmonyOS devices do not provide an official built-in setting to configure a proxy server for your mobile connection. You can only find some alternative parameters for your Wi-Fi connection or use developer-level proxy tools.

How do I verify that my proxy is actually working on HarmonyOS?

The easiest way to verify if your proxy is working on any device is to navigate to your browser and visit one of the proxy checking websites. You can use our IP lookup tool , and if the Proxy server is set up properly, the IP address and its location will be different from your real IP address.

Will setting up a proxy affect OTA updates or app store access on HarmonyOS?

If the proxy server you are using is transparent and fast, the HarmonyOS updates should continue to work normally. Some setups might interfere with OTA updates by changing DNS servers, implementing filters, or blocks. Consider disabling such proxies at least when critical updates need to be installed.

Can I use IPRoyal proxies (residential, mobile, datacenter) on HarmonyOS devices?

Yes, all IPRoyal proxy types can be used with HarmonyOS devices, but the correct setup varies depending on the model and your needs. If you are unsure of what proxy server type to choose for your HarmonyOS device, HTTP residential proxies are a safe bet.

Create Account
Share on
Article by IPRoyal
Meet our writers
Data News in Your Inbox

No spam whatsoever, just pure data gathering news, trending topics and useful links. Unsubscribe anytime.

No spam. Unsubscribe anytime.

Related articles