# System proxy server bypass (aka "excludes") does not work

**URL:** <https://forum.katalon.com/t/system-proxy-server-bypass-aka-excludes-does-not-work/61685>\
**Category:** API Testing\
**Tags:** api-testing, katalon-studio\
**Created:** [January 17, 2022, 4:55pm UTC](https://forum.katalon.com/t/system-proxy-server-bypass-aka-excludes-does-not-work/61685 "2022-01-17T16:55:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![michelg](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/michelg/32/18008_2.png) [@michelg](https://forum.katalon.com/u/michelg)\
**Post date:** [January 17, 2022, 4:55pm UTC](https://forum.katalon.com/t/system-proxy-server-bypass-aka-excludes-does-not-work/61685/1 "2022-01-17T16:55:47Z")

</div>

Hello,

My Katalon test scripts run on a VM using a proxy.  
- For KS, it is declared in Window \ Katalon Studio Preferences \ Katalon \ Proxy \ System:  
Proxy option: Manual proxy configuration  
Proxy server type: HTTP  
Address: xxx, Port: yyy  
- For KRE, my command-lines include: -proxy.system.option=MANUAL\_CONFIG -proxy.system.server.type=HTTP -proxy.system.server.address=xxx -proxy.system.server.port=yyy

Now, when calling some very special REST API, I have to bypass this proxy.

I have tried two options (see below). None work. What am I doing wrong?

Option (a): Declare an exception  
- In KS: Fill the text box for “Excludes” with “_.subdomain.domain.com"  
- In KRE: Add the -proxy.system.excludes="_.subdomain.domain.com” option  
It does not work. The “excludes” seems ignored. Does pattern matching work? I have tried with the full server name, it does not work.

Option (b): In the keyword which does the call to the REST API, override the default proxy stuff.  
The code is:

> ```
> // Get current proxy information
> KeywordUtil.logInfo("Proxy Info: "+ ro.getProxy())
>   
> // Override proxy
> ProxyInformation specialProxy = new ProxyInformation();
> specialProxy.setProxyOption(ProxyOption.NO_PROXY.toString())
> ro.setProxy(specialProxy)
>   
> KeywordUtil.logInfo("Proxy Info FOR THIS REQUEST: "+ ro.getProxy())
>   
> //Send the request
> ResponseObject respObj = WS.sendRequest(ro)
> 
> ```

The log suggests the switch worked:

> 20:30:39.657 INFO Proxy Info: ProxyInformation { proxyOption=MANUAL\_CONFIG, proxyServerType=HTTP, username=, password=**, proxyServerAddress=xxx, proxyServerPort=yyy, executionList=“\*.subdomain.domain.com”, isApplyToDesiredCapabilities=true }   
> 20:30:39.683 INFO Proxy Info FOR THIS REQUEST: ProxyInformation { proxyOption=NO\_PROXY, proxyServerType=null, username=null, password=**, proxyServerAddress=null, proxyServerPort=0, executionList=“null”, isApplyToDesiredCapabilities=false }

… but the HAR showed that the request went through the proxy (and failed). In other words, the proxy info which I had setup was just ignored.

Thanks in advance for any help.

Regards,  
– Michel

---

<div class="post-metadata">

**Author:** ![michelg](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/michelg/32/18008_2.png) [@michelg](https://forum.katalon.com/u/michelg)\
**Post date:** [January 18, 2022, 12:21pm UTC](https://forum.katalon.com/t/system-proxy-server-bypass-aka-excludes-does-not-work/61685/2 "2022-01-18T12:21:20Z")

</div>

> [@michelg](#):
>
> Window \ Katalon Studio Preferences \ Katalon \ Proxy \ System:  
> Proxy option: Manual proxy configuration

Reading more thoroughly the page [https://docs.katalon.com/katalon-studio/docs/proxy-preferences.html#override-proxy-details-in-the-test-script](https://docs.katalon.com/katalon-studio/docs/proxy-preferences.html#override-proxy-details-in-the-test-script) …

a) I have not been able to understand how to make the command-line option “ **-proxy.system.excludes** ” work. Even with the full path, even with the port explicitly added, it never works. Very frustrating.

b) I have not been able to set a “noProxy” proxy object directly inside the Response Object.  
` KeywordUtil.logInfo("Proxy Info - ReqObject - Init: "+ ro.getProxy())`  
Whatever I set in this object, it seems ignored.

c) I have been able to switch the proxy object embedded in the Run Preferences.  
It’s the least elegant option, but, well… it works.

```
import com.google.gson.Gson
import com.kms.katalon.core.configuration.RunConfiguration 
import com.kms.katalon.core.network.ProxyInformation 
import com.kms.katalon.core.network.ProxyOptionn

public ResponseObject bypassProxyAndSendRequest(RequestObject ro) {

	// Display proxy information - Initial
	KeywordUtil.logInfo("Proxy Info - RunConfig - Init: "+ RunConfiguration.getProxyInformation())
	
	// Save the initial proxy object
	ProxyInformation myInitProxy = RunConfiguration.getProxyInformation()
	
	// Build the NO_PROXY proxy object
	ProxyInformation myNoProxy = new ProxyInformation();
	myNoProxy.setProxyOption(ProxyOption.NO_PROXY.toString())
	
	// Switch to the NO_PROXY proxy object
	Map<String, Object> generalProperties = RunConfiguration.getExecutionGeneralProperties();
	generalProperties.put(RunConfiguration.PROXY_PROPERTY, new Gson().toJson(myNoProxy));
	
	// Display proxy information - After the switch
	KeywordUtil.logInfo("Proxy Info - RunConfig - After Switch: "+ RunConfiguration.getProxyInformation())
	
	// Send the request
	ResponseObject respObj = WS.sendRequest(ro)

	// Rollback to the initial proxy object
	generalProperties.put(RunConfiguration.PROXY_PROPERTY, new Gson().toJson(myInitProxy));
	
	// Display proxy information - After the rollback
	KeywordUtil.logInfo("Proxy Info - RunConfig - After Rollback: "+ RunConfiguration.getProxyInformation())
	
	return respObj
	
}

```
