You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You need to tell the Proxy() constructor where browsermob-proxy is running. The defaults are running on 'localhost' port 8080:
33
+
34
+
```javascript
35
+
36
+
proxy =newProxy();
37
+
```
38
+
39
+
Starting browsermob-proxy somewhere else?:
40
+
41
+
```javascript
42
+
43
+
proxy =newProxy({ host:'some.other.host', port:<some other port> });
44
+
```
45
+
46
+
**Optionally Specifying a fixed Proxy Port**
47
+
48
+
When you create new proxies, browsermob-proxy can automatically choose which port to open them on.
49
+
50
+
Alternatively, you can specify the port you expect proxes to be created on when you create the proxy object by setting it here:
51
+
52
+
```javascript
53
+
54
+
proxy =newProxy({ proxyPort:<some other port> });
55
+
```
56
+
57
+
*N.B.* You can also specify a port when using the doHAR or cbHAR functions for more fine tuned control
58
+
59
+
Ports passed to doHAR / cbHAR take override any proxyPort set here. And if no proxy port is set here or passed to those functions, then browsermob-proxy will fall back to automatcially choosing a port and reporting to the user the host:port on which the proxy has been created.
60
+
61
+
**Optionally Specifying Selenium Host & Port**
62
+
63
+
IF using Selenium you can specify the host and port. The defaults are 'localhost' port 4444:
64
+
65
+
```javascript
66
+
67
+
proxy =newProxy({ selHost:'some.other.host', selPort:<some other port> });
68
+
```
69
+
70
+
**Bandwidth Limits**
71
+
72
+
In the Proxy constructor you can specify bandwidth and latency limitations like so:
73
+
74
+
```javascript
75
+
var proxy =newProxy( { downloadKbps=>56, uploadKbps=>56, latency 200 } );
76
+
```
77
+
78
+
Would tell the proxy to act like a 56K modem with 200ms latency.
79
+
80
+
29
81
Details
30
82
-------
31
83
@@ -47,22 +99,6 @@ CasperJS
47
99
48
100
Grab the latest version of [CasperJS](http://casperjs.org)
49
101
50
-
Configure the Proxy Object
51
-
---------------------------
52
-
53
-
You need to tell the Proxy() constructor where browsermob-proxy is running. The defaults are running on 'localhost' port 8080:
54
-
55
-
```javascript
56
-
57
-
proxy =newProxy();
58
-
```
59
-
60
-
Somewhere else?:
61
-
62
-
```javascript
63
-
64
-
proxy =newProxy({ host:'some.other.host', port:<some other port> });
65
-
```
66
102
67
103
Convenience API
68
104
----------------
@@ -82,6 +118,7 @@ PARAMETERS
82
118
* CALLBACK(ERROR, HAR) function
83
119
1. ERROR string if there was an error
84
120
2. HAR string data
121
+
* (optional) PROXY_PORT - port on which proxy will be available (If passed then this port will override any proxyPort set in configuration when creating the proxy)
85
122
86
123
EXAMPLE:
87
124
@@ -105,7 +142,7 @@ Convenience method to get HAR data - this method allows you to generate whatever
105
142
106
143
PARAMETERS
107
144
108
-
* OPTIONS is an object with keys 'name', 'captureHeaders', 'captureContent' and 'captureBinaryContent'; 'name' is an abritrary name for this run - like 'yahoo.com' or whatever you like; 'captureHeaders', 'captureContent' and 'captureBinaryContent' expect booleans indicating whether to capture resp headers, body of http transactions, and binary body of transactions. For backwards compatibility reasons, if OPTIONS is a string, it will be interpreted as the name for the run.
145
+
* OPTIONS is an object with keys 'proxyPort', 'name', 'captureHeaders', 'captureContent' and 'captureBinaryContent'; 'proxyPort' the port number on which this proxy should be available (If passed then this port will override any proxyPort set in configuration when creating the proxy); 'name' is an abritrary name for this run - like 'yahoo.com' or whatever you like; 'captureHeaders', 'captureContent' and 'captureBinaryContent' expect booleans indicating whether to capture resp headers, body of http transactions, and binary body of transactions. For backwards compatibility reasons, if OPTIONS is a string, it will be interpreted as the name for the run.
109
146
* GENERATE_TRAFFIC_CALLBACK(PROXY, DONE_CALLBACK)
110
147
111
148
PARAMETERS
@@ -184,16 +221,6 @@ Here is it put all together:
184
221
185
222
This will dump a HAR file named: 'searchYahooCasper.js.har' in the current directory.
186
223
187
-
Bandwidth Limits
188
-
----------------
189
-
190
-
In the Proxy constructor you can specify bandwidth and latency limitations like so:
191
-
192
-
```javascript
193
-
var proxy =newProxy( { downloadKbps=>56, uploadKbps=>56, latency 200 } );
194
-
```
195
-
196
-
Would tell the proxy to act like a 56K modem with 200ms latency.
0 commit comments