Configuring an HTTP Proxy for Oracle Graph Client Connections
You can use the http_proxy parameter when using the Java or Python client to connect to a remote graph server (PGX) through an HTTP or HTTPS proxy.
You can specify the proxy as a URI in one of the following formats:
http://<proxy_host>:<proxy_port>https://<proxy_host>:<proxy_port>
As seen in the preceding formats, the URI must contain an http or https scheme, a valid proxy host, and an optional port.
The following command specifies the --http_proxy parameter to use a proxy configuration when connecting to a remote graph server (PGX) from the graph clients.
./bin/opg4j --base_url <server_host>:7007 --username <username> --http_proxy <proxy_host>:<port>
/bin/opg4py --base_url <server_host>:7007 --username <username> --http_proxy <proxy_host>:<port>
The proxy is configured separately for each client instance. If you omit the http_proxy parameter, the client connects directly to the graph server.
Also, note the following:
- Only HTTP and HTTPS proxies are supported.
- Proxy authentication is not supported.
- Proxy URIs containing credentials are rejected.
- SOCKS proxies, PAC files, and proxy-bypass rules such as NO_PROXY are not supported.
- The client does not automatically read HTTP_PROXY, HTTPS_PROXY, operating-system proxy settings, or JVM proxy properties.
- If the URI contains a path, query, or fragment, those components are ignored. Specify only the scheme, host, and optional port.
- In Python client, specifying
http_proxywithout a remotebase_urlraises an error.
When configuring the graph client programmatically using the ClientConfig object, you can set HTTP proxy as shown in the following example:
var clientConfig =
ClientConfigBuilder.
forBaseUrl("<graph_server_host>:<port>").
setHttpProxy("<proxy_host>:<proxy_port>").
build()
var instance = GraphServer.getInstance(clientConfig, "<username>", "<password_for user>".toCharArray())
ClientConfig clientConfig =
ClientConfigBuilder
.forBaseUrl("<graph_server_host>:<port>")
.setHttpProxy("<proxy_host>:<proxy_port>")
.build();
ServerInstance instance = GraphServer.getInstance(clientConfig, "<username>", "<password_for user>".toCharArray());
from opg4py import graph_server
instance = graph_server.get_instance(
base_url="<graph_server_host>:<port>",
username="<username>",
password="<password_for user>"
http_proxy="<proxy_host>:<proxy_port>"
)