Configuring HTTP Proxy for OpenResty XRay Agent

If your OpenResty XRay Agent is deployed in an environment that requires access to the public network via an HTTP proxy, you can follow the steps below to configure and use an HTTP proxy.

This document will guide you on how to modify the configuration file, add proxy settings, and restart the service for the settings to take effect.

Modifying the Configuration File

After installing the OpenResty XRay Agent, you need to modify the configuration file to set up the HTTP proxy. The configuration file is located at the following path:

/usr/local/orxray-agent/conf/config.ini

After opening the configuration file, you need to add proxy_host and proxy_port settings in the [rpc] section. If your HTTP proxy also requires authentication, you should add the proxy_auth configuration item as well.

Below is an example excerpt from the configuration file:

[rpc]
# Proxy server IP address or domain name
proxy_host = "192.168.0.2"
# Proxy server port
proxy_port = 9000
# If the proxy server requires authentication, the format is "username:password"
proxy_auth = "user:password"
...

Please modify the proxy_host, proxy_port, and proxy_auth settings according to the specific details of your proxy server.

Restarting the Service

After you have modified the configuration file, you need to restart the OpenResty XRay Agent service to apply these changes. Please use the following command to restart the service:

sudo systemctl restart orxray-agent

Checking the Error Logs

After restarting the service, if you find that the Agent is still unable to connect to the console, there may be some issues. At this point, you can troubleshoot by checking the error logs.

Use the following command to view the latest error logs:

tail -n 100 /usr/local/orxray-agent/logs/error.log