--- title: "Configuring a Proxy Server" slug: "configuring-a-proxy-server" updated: 2024-10-10T11:06:20Z published: 2024-10-10T11:06:20Z canonical: "docs.onespan.com/configuring-a-proxy-server" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.onespan.com/llms.txt > Use this file to discover all available pages before exploring further. # Configuring a Proxy Server [Java SDK](/v1/docs/configuring-a-proxy-server#java-sdk) [.NET SDK](/v1/docs/configuring-a-proxy-server#net-sdk) [REST API](/v1/docs/configuring-a-proxy-server#rest-api) ## Java SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/proxy-configuration-java-sdk/) site. A proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers. With OneSpan Sign, you can make API calls via a proxy server. To make API calls to OneSpan Sign using a proxy server, you will need to build a ProxyConfiguration object. You will need to pass the proxy server's address and port number to the withHttpHost() and withHttpPort() methods respectively. ```java ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()                .withHttpHost("serverAddress") //e.g. localhost                .withHttpPort(portNumber) //e.g. 8001                .build(); ``` ### Adding Authentication If your proxy server is configured to request additional authentication, such as a username and password, you need to add these to your ProxyConfiguration object. The following code sample provides a way to do so. ```java ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()                .withHttpHost("serverAddress")                .withHttpPort(portNumber)                .withCredentials("httpUser", "httpPwd")                .build(); ``` ### Building Your EslClient The final step is to create your EslClient object. For security reasons, trusting all certificates should not be enabled. ```java boolean allowAllSSLCertificates = false; EslClient client = new EslClient(API_KEY, API_URL, allowAllSSLCertificates, httpProxyConfiguration); ``` ## .NET SDK To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/proxy-configuration-net-sdk/) site. A proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers. With OneSpan Sign, you can make API calls via a proxy server. To make API calls to OneSpan Sign using a proxy server, you will need to build a ProxyConfiguration object. You will need to pass the proxy server's address and port number to the withHttpHost() and withHttpPort() methods respectively. ```csharp ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()                .WithHttpHost("serverAddress") //e.g. localhost                .WithHttpPort(portNumber) //e.g. 8001                .Build(); ``` ### Adding Authentication If your proxy server is configured to request additional authentication, such as a username and password, you need to add these to your ProxyConfiguration object. The following code sample provides a way to do so. ```csharp ProxyConfiguration httpProxyConfiguration = ProxyConfigurationBuilder.newProxyConfiguration()                .WithHttpHost("serverAddress")                .WithHttpPort(portNumber)                .WithCredentials("httpUser", "httpPwd")                .Build(); ``` ### Building Your EslClient The final step is to create your EslClient object. For security reasons, trusting all certificates should not be enabled. ```csharp Boolean allowAllSSLCertificates = false; EslClient client = new EslClient(API_KEY, API_URL, allowAllSSLCertificates, httpProxyConfiguration); ``` ## REST API To download the full code sample see our [Code Share](https://community.onespan.com/documentation/onespan-sign/codeshare/proxy-configuration-rest-api/) site. A proxy server is a server that acts as an intermediary for requests from clients seeking resources from other servers. With OneSpan Sign, you can make API calls via a proxy server. To make API calls to OneSpan Sign using a proxy server, you will need to build a ProxyConfiguration object. You will need to pass the proxy server's address and port number to the withHttpHost() and withHttpPort() methods respectively. ### Building a WebProxy Object The first step in making API calls to OneSpan Sign through a proxy server is to build a WebProxy object. When doing this set, the UseDefaultCredentials property to true when requests made by your WebProxy object should, if requested by the server, be authenticated using the credentials of the currently logged on user. Otherwise, set this property to false. ```csharp string proxyUri = string.Format("{0}:{1}", "serverAddress", portNumber); //e.g. 13.1.25.80:8200 WebProxy proxy = new WebProxy(proxyUri, false) {        UseDefaultCredentials = false }; ``` ### Creating a HttpClient Next, you will need to create the HttpClient that will be used to send requests to OneSpan Sign. In this example, you will need to create one with a specific handler. Note that: - The Proxy property sets the proxy information used by the handler. - The PreAuthenticate property indicates the handler will send an Authorization header with the request. ```csharp HttpClient client = null; HttpClientHandler httpClientHandler = new HttpClientHandler() {        Proxy = proxy,        PreAuthenticate = true,        UseDefaultCredentials = false, }; ``` ### Adding Authentication If your proxy server is configured to request additional authentication, such as a username and password, you need to add these to your ProxyConfiguration object. The following code sample provides a way to do so. ```csharp string httpUserName = "httpUser", httpPassword = "httpPwd"; httpClientHandler.Credentials = new NetworkCredential(httpUserName, httpPassword); ``` ### Initializing a New Instance of the HttpClient The last step is to initialize a new instance of the HttpClient class with the specific handler. ```csharp client = new HttpClient(httpClientHandler); ```