|
1 | 1 | ---
|
2 | 2 | id: proxies
|
3 | 3 | title: Sauce Connect 5 Setup with Additional Proxies
|
4 |
| -sidebar_label: Additional Proxies |
| 4 | +sidebar_label: Proxies |
5 | 5 | ---
|
6 | 6 |
|
7 | 7 | import useBaseUrl from '@docusaurus/useBaseUrl';
|
8 | 8 | import Tabs from '@theme/Tabs';
|
9 | 9 | import TabItem from '@theme/TabItem';
|
10 | 10 |
|
11 |
| -:::caution |
12 |
| -The Sauce Connect Proxy 4.x.x version of this article is [here](/secure-connections/sauce-connect/setup-configuration/additional-proxies). |
13 |
| -::: |
14 |
| - |
15 |
| - |
16 |
| -This guide is intended for users who need to set up additional proxies to route traffic originated from their Sauce Connect Proxy client. Additional proxies may be configured for various purposes |
17 |
| -such as improved network security, corporate internet usage policy, traffic monitoring, or caching. Sauce Connect Proxy network traffic includes: |
| 11 | +This guide explains how to configure additional proxies for routing network traffic originating from a Sauce Connect 5 client. Setting up proxies can help meet your organization's requirements for: |
18 | 12 |
|
19 |
| -- Traffic between Sauce Labs and a Sauce Connect Proxy client. |
20 |
| - - Connections are initiated by a Sauce Connect Proxy client. |
21 |
| - - Requests between a Sauce Connect Proxy client and the Sauce Labs REST API service, such as start and stop requests and status updates. |
22 |
| - - Sauce Connect Proxy long-lived HTTP/2 tunnel connection. |
23 |
| -- Traffic between Sauce Connect Proxy and the internet or internal servers serving data that your tests running on Sauce Labs infrastructure use. |
24 |
| - - This traffic originates from Sauce Labs-hosted browsers and mobile devices that are running your tests. |
| 13 | +- Network security and traffic control |
| 14 | +- Compliance with corporate internet usage policies |
| 15 | +- Traffic monitoring or caching mechanisms |
25 | 16 |
|
26 |
| -## Setting Up Sauce Connect With Your Proxy Server |
| 17 | +Sauce Connect 5 handles two types of network traffic: |
27 | 18 |
|
28 |
| -Two types of network traffic that are relevant to using proxy servers with Sauce Connect Proxy: |
| 19 | +- **Sauce Labs Traffic:** |
| 20 | + - REST API communication (e.g., start/stop requests, status updates) |
| 21 | + - Long-lived HTTP/2 tunnel connection between the client and Sauce Connect servers |
| 22 | +- **Test Traffic:** |
| 23 | + - Requests from Sauce Labs browsers or devices to the Site Under Test (SUT) on your internal or public network |
29 | 24 |
|
30 |
| -- **Test Traffic:** The Sauce Connect Proxy communicates with the Site Under Test (SUT) running in your network or public internet. |
31 |
| -- **Sauce Labs traffic** |
32 |
| - - **REST API Traffic:** The Sauce Connect Proxy client running on your network communicates to our REST API service some basic information about the Sauce Connect Proxy's status (for example, starting up, ready, stopping). |
33 |
| - - **Tunnel Traffic:** The Sauce Connect Proxy client establishes a secure long-lived connection to the Sauce Connect Proxy server in the Sauce Labs cloud to multiplex the SUT-bound traffic. |
| 25 | +## Configuring Sauce Connect 5 with Proxies |
34 | 26 |
|
35 |
| -To configure Sauce Connect Proxy to use your proxy or proxies, you will need to include one or more Sauce Connect command-line options (see the [Sauce Connect Proxy Command-Line Quick Reference Guide](/dev/cli/sauce-connect-5/run)). |
| 27 | +You can route traffic through proxy servers by using the following command-line options (see the [CLI reference](/dev/cli/sauce-connect-5/run)): |
36 | 28 |
|
37 |
| -- [`-x`/`--proxy`](/dev/cli/sauce-connect-5/run/#proxy) allows configuring proxy |
38 |
| -for SUT (test) traffic. |
39 |
| -- [`--pac`](/dev/cli/sauce-connect-5/run/#pac) allows configuring proxy for SUT |
40 |
| -(test) traffic via Proxy Auto-Configuration (PAC). |
41 |
| -- [`--proxy-sauce`](/dev/cli/sauce-connect-5/run/#proxy-sauce) allows |
42 |
| -configuring proxy for Sauce Labs REST API traffic and the tunnel traffic. |
43 |
| -- [`--auth`](/dev/cli/sauce-connect-5/run/#auth) allows configuring proxy authentication separately. |
| 29 | +- [`--proxy`](/dev/cli/sauce-connect-5/run/#proxy): proxy for test traffic (SUT) |
| 30 | +- [`--pac`](/dev/cli/sauce-connect-5/run/#pac): proxy auto-configuration for test traffic |
| 31 | +- [`--proxy-sauce`](/dev/cli/sauce-connect-5/run/#proxy-sauce): proxy for Sauce Labs REST API and tunnel |
| 32 | +- [`--auth`](/dev/cli/sauce-connect-5/run/#auth): configuring proxy authentication separately |
44 | 33 |
|
45 |
| -## Proxied Site Under Test (SUT) |
| 34 | +### Proxied Site Under Test (SUT) |
46 | 35 |
|
47 |
| -In this configuration, the Site Under Test (SUT) is behind a proxy (sometimes also called an upstream proxy), see the diagram below. This setup controls access to the SUT by IP allow-listing or by restricting proxy access to users with valid username/password credentials. Depending on your setup, this proxy may or may not be able to access the public internet. |
| 36 | +In this configuration, the Site Under Test (SUT) is behind a proxy (sometimes also called an upstream proxy). |
| 37 | +This setup controls access to the SUT by IP allow-listing or by restricting proxy access to users with valid username/password credentials. |
| 38 | +Depending on your setup, this proxy may or may not be able to access the public internet. |
48 | 39 |
|
49 |
| -<img src={useBaseUrl('img/sauce-connect/scp5-sut-proxy.png')} alt="Site Under Test (SUT) behind a proxy" width="800"/> |
| 40 | +#### `--proxy` |
50 | 41 |
|
51 |
| -### `--proxy` |
| 42 | +Use the [`--proxy`](/dev/cli/sauce-connect-5/run/#proxy) flag to define a proxy for test traffic in the format: |
| 43 | +`[protocol://][user:pass@host:port]` |
52 | 44 |
|
53 |
| -The [`-x`/`--proxy`](/dev/cli/sauce-connect-5/run/#proxy) sets a proxy using |
54 |
| -the following format: `[protocol://][user:pass@host:port]`. For example, |
55 |
| -`https://user:[email protected]:443`. |
| 45 | +Supported protocols are HTTP, HTTPS, SOCKS, and SOCKS5. If not specified, the default protocol is HTTP. |
| 46 | +* HTTP: `--proxy local.dev:8080` |
| 47 | +* HTTP: `--proxy http://local.dev:8080` |
| 48 | +* HTTPS: `--proxy https://local.dev:4443` |
| 49 | +* SOCKS5: `--proxy socks5//stunnel.local.dev:4443` |
56 | 50 |
|
57 |
| -- Supported protocols are HTTP, HTTPS, SOCKS, and SOCKS5. If not specified, the default protocol is HTTP. Examples of different protocols: |
58 |
| - - HTTP: `--proxy local.dev:8080` |
59 |
| - - HTTP: `--proxy http://local.dev:8080` |
60 |
| - - HTTPS: `--proxy https://local.dev:4443` |
61 |
| - - SOCKS5: `--proxy socks5//stunnel.local.dev:4443` |
62 |
| -- Authentication is optional and added if your proxy requires it. Alternatively, |
63 |
| -the authentication can be configured via the [`--auth`](/dev/cli/sauce-connect-5/run/#auth) flag. For example: |
64 |
| - - `--proxy https://user:[email protected]:4443` or `--proxy https://local.dev:4443 --auth user:[email protected]:4443` |
| 51 | +Authentication is optional and added if your proxy requires it. Alternatively, the authentication can be configured via the [`--auth`](#--auth) flag. For example: |
| 52 | +* `--proxy https://user:[email protected]:4443` |
| 53 | +* `--proxy https://local.dev:4443 --auth user:[email protected]:4443` |
65 | 54 |
|
66 | 55 | :::note
|
67 |
| -The [`--proxy`](/dev/cli/sauce-connect-5/run/#proxy) flag configures the proxy |
68 |
| -for test traffic only. Use the [`--proxy-sauce`](#--proxy-sauce) flag to configure |
69 |
| -a proxy for the Sauce Labs REST API and Sauce Connect Server traffic. |
| 56 | +The `--proxy` flag applies only to test traffic. To configure a proxy for communication with Sauce Labs services, use [`--proxy-sauce`](#--proxy-sauce) |
70 | 57 | :::
|
71 | 58 |
|
72 |
| -### `--pac` |
| 59 | +#### `--pac` |
73 | 60 |
|
74 |
| -Sometimes, proxy configuration for test traffic is more complex having just a single proxy for all resources. For example, your organization may have multiple proxy servers that allow access to different URL types i.e. one proxy for internal sites and another one for the public internet. |
75 |
| -Sauce Connect Proxy allows configuring multiple proxies using industry-standard Proxy Auto-Configuration (PAC) with the [`--pac`](/dev/cli/sauce-connect-5/run/#pac) flag. The argument can be a local path or a URL. For example: |
| 61 | +For more complex setups, Sauce Connect allows configuring multiple proxies using industry-standard Proxy Auto-Configuration (PAC) with the [`--pac`](/dev/cli/sauce-connect-5/run#pac) flag. |
| 62 | +The argument can be a local path or a URL. |
76 | 63 |
|
77 |
| -- A relative path to a file, `--pac ../../relative/directory/my.pac` |
78 |
| -- An absolute path to a file, `--pac /path/to/my.pac` |
79 |
| -- A local file URL, `--pac file:///path/to/my.pac` |
80 |
| -- A remote URL, `--pac http://internal.dev:8080/my.pac` |
| 64 | +* Relative path: `--pac ../../relative/path/proxy.pac` |
| 65 | +* Absolute path: `--pac /etc/sc5/proxy.pac` |
| 66 | +* File URL: `--pac file:///etc/sc5/proxy.pac` |
| 67 | +* Remote URL: `--pac http://proxy.local/proxy.pac` |
81 | 68 |
|
82 |
| -If needed, proxy authentication can be specified with [`--auth`](#--auth) |
| 69 | +Authentication can be configured via [`--auth`](#--auth) if required. |
83 | 70 |
|
84 | 71 | :::note
|
85 |
| -The [`--pac`](/dev/cli/sauce-connect-5/run/#pac) flag configures the proxy for |
86 |
| -test traffic only. Use the [`--proxy-sauce`](#--proxy-sauce) flag to configure a |
87 |
| -proxy for the Sauce Labs REST API and Sauce Connect Server traffic. |
| 72 | +The `--pac` flag configures proxies for test traffic only. To proxy Sauce Labs API and tunnel traffic, use [`--proxy-sauce`](#--proxy-sauce). |
88 | 73 | :::
|
89 | 74 |
|
90 |
| -### `--auth` |
91 |
| - |
92 |
| -Allows setting site or upstream proxy basic authentication credentials in the format `username:password@host:port`. |
93 |
| -Either host or port can be set to `"*"` to match all. The flag can be specified multiple times to add multiple credentials. |
94 |
| - |
95 |
| -Examples: |
| 75 | +#### `--auth` |
96 | 76 |
|
97 |
| -- Set authentication for an upstream proxy on port 4443: `--proxy https://local.dev:4443 --auth user:[email protected]:4443` |
98 |
| -- Set authentication for an upstream proxy on all ports: `--proxy https://local.dev:4443 --auth "user:[email protected]:*"` |
99 |
| -- Set authentication to a website: `--auth "user:[email protected]*"` |
100 |
| -- Set authentication for different proxies returned by PAC: `--auth user1:[email protected]:443 --auth user2:[email protected]:4443 --pac ./mypac.pac` |
| 77 | +Use the [`--auth`](/dev/cli/sauce-connect-5/run#auth) flag to provide credentials for authenticating with an upstream proxy that requires them. |
| 78 | +Networks that enforce access control on proxy usage require this flag for successful authentication. |
| 79 | +For detailed usage see the [Upstream Authentication guide](/secure-connections/sauce-connect-5/guides/upstream-auth/). |
101 | 80 |
|
102 |
| -## Proxied Sauce Labs REST API and Sauce Connect Server |
| 81 | +### Proxied Sauce Labs REST API and Tunnel Server |
103 | 82 |
|
104 |
| -In this configuration, requests to Sauce Labs are behind a proxy, see the diagram below. This proxy must be able to access Sauce Labs over the public internet. |
| 83 | +Use this configuration when Sauce Connect Client must reach Sauce Labs services via a corporate proxy. This proxy must allow outbound access to Sauce Labs over the public internet. |
105 | 84 |
|
106 |
| -<img src={useBaseUrl('img/sauce-connect/scp5-sauce-proxy.png')} alt="Sauce behind a proxy" width="800"/> |
| 85 | +#### `--proxy-sauce` |
107 | 86 |
|
108 |
| -### `--proxy-sauce` |
| 87 | +Use the [`--proxy-sauce`](/dev/cli/sauce-connect-5/run/#proxy-sauce) flag to specify a proxy for: |
| 88 | +* REST API traffic |
| 89 | +* Long-lived tunnel connections to the Sauce Connect server |
109 | 90 |
|
110 |
| -The [`--proxy-sauce`](/dev/cli/sauce-connect-5/run/#proxy-sauce) defines a proxy |
111 |
| -that Sauce Connect should use to route requests to the Sauce Labs REST API |
112 |
| -service and Sauce Connect Proxy Server. The proxy URL format is the same as for |
113 |
| -the [`--proxy`](#--proxy) flag. |
| 91 | +Format: `[protocol://][user:pass@host:port]` |
114 | 92 |
|
115 |
| -This flag is introduced in version 5.0.0 to allow separate proxy configuration |
116 |
| -for test traffic and the tunnel traffic without using a more complex [`--pac`](/dev/cli/sauce-connect-5/run/#pac) |
117 |
| -flag. |
| 93 | +This lets you route Sauce Labs communication through a separate proxy from your test traffic, without relying on a PAC file. |
118 | 94 |
|
119 | 95 | :::note
|
120 |
| -The [`--proxy-sauce`](/dev/cli/sauce-connect-5/run/#proxy-sauce) flag configures |
121 |
| -the Sauce Labs REST API and a tunnel server traffic only. Use the [`--proxy`](#--proxy) |
122 |
| -flag to configure a proxy for the test traffic. |
| 96 | +The `--proxy-sauce` flag configures only the Sauce Labs API and tunnel traffic. Use [`--proxy`](#--proxy) or [`--pac`](#--pac) for test traffic. |
123 | 97 | :::
|
0 commit comments