1. Confirm an active service
Open the CloudCity portal with your existing account. Select the eligible active service and explicitly reveal its connection details. An order, pending activation or the public preview is not a usable endpoint. Record the host, port, supported protocol and authentication mode exactly as supplied.
2. Configure your environment
The examples below use PROXY_HOST, PROXY_PORT, PROXY_USER, PROXY_PASSWORD and TARGET_URL. Inject the real values through your secret manager or local environment; do not commit them to source. The displayed .invalid host deliberately cannot resolve. Set TARGET_URL to a small HTTPS page you own or are authorized to test.
3. Keep transport checks enabled
Use the proxy protocol the service supports. An HTTP proxy can tunnel an HTTPS target with CONNECT; this does not mean the connection to the proxy itself uses TLS. Keep target certificate verification enabled. Apply a connection and overall timeout before the first request.
4. Inspect the result before scaling
Check the response status and expected content, not only command exit success. A 407 concerns proxy authentication; a 403 or 429 may come from the target or an upstream policy. Stop and diagnose repeated failures. Measure the pilot’s traffic and agree limits before increasing concurrency.
Runtime notes
cURL and PHP require their cURL support; Python uses requests; Node.js uses undici and ProxyAgent; Go and Java use standard HTTP libraries; C# uses HttpClient. Install dependencies in your own project. Samples are integration recipes, not a remote execution feature of this page.
# Set these variables from your active service, locally.
# Example host: proxy.example.invalid (deliberately non-resolving).
curl --connect-timeout 10 --max-time 30 \
--proxy "http://${PROXY_HOST}:${PROXY_PORT}" \
--proxy-user "${PROXY_USER}:${PROXY_PASSWORD}" \
--url "$TARGET_URL"import os
from urllib.parse import quote
import requests
user = quote(os.environ["PROXY_USER"], safe="")
password = quote(os.environ["PROXY_PASSWORD"], safe="")
host, port = os.environ["PROXY_HOST"], os.environ["PROXY_PORT"]
proxy = f"http://{user}:{password}@{host}:{port}"
response = requests.get(os.environ["TARGET_URL"],
proxies={"http": proxy, "https": proxy},
timeout=(10, 20), allow_redirects=False)
print(response.status_code)<?php
$request = curl_init(getenv('TARGET_URL'));
curl_setopt_array($request, [
CURLOPT_PROXY => getenv('PROXY_HOST').':'.getenv('PROXY_PORT'),
CURLOPT_PROXYTYPE => CURLPROXY_HTTP,
CURLOPT_PROXYUSERPWD => getenv('PROXY_USER').':'.getenv('PROXY_PASSWORD'),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 30,
]);
$response = curl_exec($request);
if ($response === false) { throw new RuntimeException('Request failed'); }
echo curl_getinfo($request, CURLINFO_RESPONSE_CODE);
curl_close($request);import { request, ProxyAgent } from 'undici';
const env = process.env;
const dispatcher = new ProxyAgent({
uri: `http://${env.PROXY_HOST}:${env.PROXY_PORT}`,
token: `Basic ${Buffer.from(`${env.PROXY_USER}:${env.PROXY_PASSWORD}`).toString('base64')}`,
connect: { timeout: 10000 }
});
try {
const result = await request(env.TARGET_URL, {
dispatcher, signal: AbortSignal.timeout(30000),
maxRedirections: 0
});
console.log(result.statusCode);
await result.body.dump();
} finally { await dispatcher.close(); }package main
import ("fmt"; "net/http"; "net/url"; "os"; "time")
func main() {
proxy := &url.URL{Scheme: "http",
Host: os.Getenv("PROXY_HOST") + ":" + os.Getenv("PROXY_PORT"),
User: url.UserPassword(os.Getenv("PROXY_USER"), os.Getenv("PROXY_PASSWORD"))}
client := &http.Client{Timeout: 30 * time.Second,
Transport: &http.Transport{Proxy: http.ProxyURL(proxy)},
CheckRedirect: func(_ *http.Request, _ []*http.Request) error { return http.ErrUseLastResponse }}
response, err := client.Get(os.Getenv("TARGET_URL"))
if err != nil { fmt.Println("Request failed"); return }
defer response.Body.Close()
fmt.Println(response.StatusCode)
}// Java 11+. Verify the JDK proxy-authentication policy for HTTPS CONNECT.
import java.net.*;
import java.net.http.*;
import java.time.Duration;
class ProxyCheck {
public static void main(String[] args) throws Exception {
String host = System.getenv("PROXY_HOST");
int port = Integer.parseInt(System.getenv("PROXY_PORT"));
HttpClient client = HttpClient.newBuilder()
.proxy(ProxySelector.of(new InetSocketAddress(host, port)))
.connectTimeout(Duration.ofSeconds(10))
.authenticator(new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
if (getRequestorType() != RequestorType.PROXY ||
!host.equalsIgnoreCase(getRequestingHost()) || getRequestingPort() != port) return null;
return new PasswordAuthentication(System.getenv("PROXY_USER"),
System.getenv("PROXY_PASSWORD").toCharArray());
}
}).build();
HttpRequest request = HttpRequest.newBuilder(URI.create(System.getenv("TARGET_URL")))
.timeout(Duration.ofSeconds(30)).GET().build();
System.out.println(client.send(request, HttpResponse.BodyHandlers.discarding()).statusCode());
}
}using System;
using System.Net;
using System.Net.Http;
var proxy = new WebProxy($"http://{Environment.GetEnvironmentVariable("PROXY_HOST")}:{Environment.GetEnvironmentVariable("PROXY_PORT")}") {
Credentials = new NetworkCredential(
Environment.GetEnvironmentVariable("PROXY_USER"),
Environment.GetEnvironmentVariable("PROXY_PASSWORD"))
};
using var handler = new HttpClientHandler { Proxy = proxy, UseProxy = true, AllowAutoRedirect = false };
using var client = new HttpClient(handler) { Timeout = TimeSpan.FromSeconds(30) };
using var response = await client.GetAsync(Environment.GetEnvironmentVariable("TARGET_URL"));
Console.WriteLine((int)response.StatusCode);Example, no real credentials. Read the quickstart for environment variables, TLS and installation notes. Never paste production secrets into a public preview. Read the quickstart →