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 use PROXY_URL, PROXY_USER, PROXY_PASSWORD and TARGET_URL. PROXY_URL is the complete proxy address with its protocol, host and port, without a username or password; for example https://proxy.example.invalid:443. Copy the exact protocol from the active service, including https://. Supply credentials through your secret manager or local environment; do not commit them to source. The .invalid address is only an example. Set TARGET_URL to a small HTTPS page you own or are authorized to test.
3. Keep transport checks enabled
Preserve the protocol supplied by the service and verify certificates for both the proxy and the HTTPS target. Do not replace https:// with http:// to work around an error. CONNECT through an HTTP proxy does not itself encrypt the connection to that proxy. For a certificate error, check the address and your application’s trusted certificates. Use timeouts and stop repeated requests until the issue is resolved.
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
These examples cover HTTP/HTTPS proxies. Use cURL and PHP with HTTPS proxy support and an up-to-date trust store; Python with requests; Node.js 20+ with undici; Go 1.22+; Java 17+ with Apache HttpClient 5.5; or C# with .NET 8+. For other protocols, choose a compatible example in the generator. Install dependencies in your own project. Your application runs this code; this page does not execute it.
# Set these variables from your active service, locally.
# PROXY_URL includes the exact protocol, host and port, without credentials.
curl --connect-timeout 10 --max-time 30 \
--proxy "$PROXY_URL" \
--proxy-user "${PROXY_USER}:${PROXY_PASSWORD}" \
--url "$TARGET_URL"# Requires: pip install requests
import os
from urllib.parse import quote, urlsplit, urlunsplit
import requests
user = quote(os.environ["PROXY_USER"], safe="")
password = quote(os.environ["PROXY_PASSWORD"], safe="")
address = urlsplit(os.environ["PROXY_URL"])
if address.scheme not in ("http", "https") or not address.hostname or address.username or address.password:
raise ValueError("Use the credential-free HTTP or HTTPS proxy URL from your service")
proxy = urlunsplit((address.scheme, f"{user}:{password}@{address.netloc}", "", "", ""))
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_URL'),
CURLOPT_PROXYUSERPWD => getenv('PROXY_USER').':'.getenv('PROXY_PASSWORD'),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_SSL_VERIFYPEER => true,
CURLOPT_SSL_VERIFYHOST => 2,
CURLOPT_PROXY_SSL_VERIFYPEER => true,
CURLOPT_PROXY_SSL_VERIFYHOST => 2,
]);
$response = curl_exec($request);
if ($response === false) { throw new RuntimeException('Request failed'); }
echo curl_getinfo($request, CURLINFO_RESPONSE_CODE);
curl_close($request);// Node.js 20+; npm install undici
import { request, ProxyAgent } from 'undici';
const env = process.env;
const dispatcher = new ProxyAgent({
uri: env.PROXY_URL,
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, err := url.Parse(os.Getenv("PROXY_URL"))
if err != nil || proxy.Host == "" || (proxy.Scheme != "http" && proxy.Scheme != "https") { panic("Invalid proxy URL") }
proxy.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 17+; Maven: org.apache.httpcomponents.client5:httpclient5:5.5
import org.apache.hc.client5.http.auth.AuthScope;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
import org.apache.hc.client5.http.impl.classic.HttpClients;
import org.apache.hc.core5.http.HttpHost;
import org.apache.hc.core5.util.Timeout;
class ProxyCheck {
public static void main(String[] args) throws Exception {
var proxy = HttpHost.create(System.getenv("PROXY_URL"));
var credentials = new BasicCredentialsProvider();
credentials.setCredentials(new AuthScope(proxy), new UsernamePasswordCredentials(
System.getenv("PROXY_USER"), System.getenv("PROXY_PASSWORD").toCharArray()));
var config = RequestConfig.custom().setConnectTimeout(Timeout.ofSeconds(10))
.setResponseTimeout(Timeout.ofSeconds(30)).setRedirectsEnabled(false).build();
try (var client = HttpClients.custom().setProxy(proxy)
.setDefaultCredentialsProvider(credentials).setDefaultRequestConfig(config).build()) {
int status = client.execute(new HttpGet(System.getenv("TARGET_URL")), response -> response.getCode());
System.out.println(status);
}
}
}// .NET 8+
using System;
using System.Net;
using System.Net.Http;
var proxy = new WebProxy(Environment.GetEnvironmentVariable("PROXY_URL")) {
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 →