Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit 67be01d

Browse files
ericbelandepic-alex-rodionov
authored andcommitted
Update the Readme to remove the legacy implementation references
1 parent de4d970 commit 67be01d

File tree

1 file changed

+13
-73
lines changed

1 file changed

+13
-73
lines changed

README.md

Lines changed: 13 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
BrowserUp Proxy allows you to manipulate HTTP requests and responses, capture HTTP content, and export performance data as a [HAR file](http://www.softwareishard.com/blog/har-12-spec/).
44
BrowserUp Proxy works well as a standalone proxy server, but it is especially useful when embedded in Selenium tests.
55

6-
The latest version of BrowserUp Proxy is 3.0.0-beta. BrowserUp Proxy is originally forked from [BrowserMobProxy](https://github.com/lightbody/browsermob-proxy) and is powered by [LittleProxy](https://github.com/adamfisk/LittleProxy).
6+
BrowserUp Proxy is originally forked from [BrowserMobProxy](https://github.com/lightbody/browsermob-proxy) and is powered by [LittleProxy](https://github.com/adamfisk/LittleProxy).
7+
See [CHANGELOG.md] for updates.
78

89
If you're running BrowserUp Proxy within a Java application or Selenium test, get started with [Embedded Mode](#getting-started-embedded-mode). If you want to run BUP from the
910
command line as a standalone proxy, start with [Standalone](#getting-started-standalone).
@@ -32,7 +33,7 @@ Then configure your HTTP client to use a proxy running at the specified port.
3233
**Using with Selenium?** See the [Using with Selenium](#using-with-selenium) section.
3334

3435
### Getting started: Standalone
35-
To run in standalone mode from the command line, first download the latest release from the [releases page](https://github.com/lightbody/BrowserUp-proxy/releases), or [build the latest from source](#building-the-latest-from-source).
36+
To run in standalone mode from the command line, first download the latest release from the [releases page](https://github.com/browserup/browserup-proxy/releases), or [build the latest from source](#building-the-latest-from-source).
3637

3738
Start the REST API:
3839
```sh
@@ -48,45 +49,6 @@ Then create a proxy server instance:
4849
The "port" is the port of the newly-created proxy instance, so configure your HTTP client or web browser to use a proxy on the returned port.
4950
For more information on the features available in the REST API, see [the REST API documentation](#rest-api).
5051

51-
## Changes since 2.0.0
52-
53-
The new [BrowserUpProxyServer class](browserup-proxy-core/src/main/java/com/browserup/bup/BrowserUpProxyServer.java) has replaced the legacy ProxyServer implementation. The legacy implementation is no longer actively supported; all new code should use `BrowserUpProxyServer`. We highly recommend that existing code migrate to the new implementation.
54-
55-
The most important changes from 2.0 are:
56-
57-
- [Separate REST API and Embedded Mode modules](#embedded-mode). Include only the functionality you need.
58-
- [New BrowserUpProxy interface](browserup-proxy-core/src/main/java/com/browserup/bup/BrowserUpProxy.java). The new interface will completely replace the legacy 2.0 ProxyServer contract in version 3.0 and higher.
59-
- [LittleProxy support](#littleproxy-support). More stable and more powerful than the legacy Jetty back-end.
60-
61-
### New BrowserUpProxy API
62-
63-
BrowserUp Proxy 2.1 includes a [new BrowserUpProxy interface](browserup-proxy-core/src/main/java/com/browserup/bup/BrowserUpProxy.java) to interact with BrowserUp Proxy programmatically. The new interface defines the functionality that BrowserUp Proxy will support in future releases (including 3.0+). To ease migration, both the legacy (Jetty-based) ProxyServer class and the new, LittleProxy-powered BrowserUpProxy class support the new BrowserUpProxy interface.
64-
65-
We _highly_ recommend migrating existing code to the BrowserUpProxy interface using the `BrowserUpProxyServer` class.
66-
67-
### Using the LittleProxy implementation with 2.0.0 code
68-
69-
The legacy interface, implicitly defined by the ProxyServer class, has been extracted into `com.browserup.bup.proxy.LegacyProxyServer` and is now officially deprecated. The new LittleProxy-based implementation will implement LegacyProxyServer for all 2.1.x releases. This means you can switch to the LittleProxy-powered implementation with minimal change to existing code ([with the exception of interceptors](#http-request-manipulation)):
70-
71-
```java
72-
// With the Jetty-based 2.0.0 release, BUP was created like this:
73-
ProxyServer proxyServer = new ProxyServer();
74-
proxyServer.start();
75-
// [...]
76-
77-
// To use the LittleProxy-powered 2.1.4 release, simply change to
78-
// the LegacyProxyServer interface and the adapter for the new
79-
// LittleProxy-based implementation:
80-
LegacyProxyServer proxyServer = new BrowserUpProxyServerLegacyAdapter();
81-
proxyServer.start();
82-
// Almost all deprecated 2.0.0 methods are supported by the
83-
// new BrowserUpProxyServerLegacyAdapter implementation, so in most cases,
84-
// no further code changes are necessary
85-
```
86-
87-
LegacyProxyServer will not be supported after 3.0 is released, so we recommend migrating to the `BrowserUpProxy` interface as soon as possible. The new interface provides additional functionality and is compatible with both the legacy Jetty-based ProxyServer implementation [(with some exceptions)](new-interface-compatibility.md) and the new LittleProxy implementation.
88-
89-
If you must continue using the legacy Jetty-based implementation, include the `browserup-proxy-core-legacy` artifact instead of `browserup-proxy-core`.
9052

9153
## Features and Usage
9254

@@ -101,8 +63,6 @@ The proxy is programmatically controlled via a REST interface or by being embedd
10163

10264
### REST API
10365

104-
**New in 2.1:** LittleProxy is the default implementation of the REST API. You may specify `--use-littleproxy false` to disable LittleProxy in favor of the legacy Jetty 5-based implementation.
105-
10666
To get started, first start the proxy by running `BrowserUp-proxy` or `BrowserUp-proxy.bat` in the bin directory:
10767

10868
$ sh BrowserUp-proxy -port 8080
@@ -156,7 +116,6 @@ Empties the DNS cache | DELETE | */proxy/[port]/dns/cache* ||
156116
| [REST API interceptors with LittleProxy](#interceptorsRESTapiLP) |||
157117
|Describe your own request interception | POST | */proxy/[port]/filter/request* | A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLPRequestFilter) |
158118
|Describe your own response interception | POST | */proxy/[port]/filter/response* | A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLPResponseFilter) |
159-
| [REST API with Legacy interceptors](#interceptorsRESTapiLegacy) ||||
160119
|Describe your own request interception | POST | */proxy/[port]/interceptor/request* | A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLegacy) |
161120
|Describe your own response interception | POST | */proxy/[port]/interceptor/response* | A string which determinates interceptor rules. See more [here](#interceptorsRESTapiLegacy) |
162121

@@ -194,18 +153,15 @@ system properties will be used to specify the upstream proxy.
194153

195154
### Embedded Mode
196155

197-
**New in 2.1:** New Embedded Mode module
198-
199-
**New in 2.1:** New [BrowserUpProxy interface](#new-BrowserUpproxy-api) for Embedded Mode
200156

201-
BrowserUp Proxy 2.1 separates the Embedded Mode and REST API into two modules. If you only need Embedded Mode functionality, add the `browserup-proxy-core` artifact as a dependency. The REST API artifact is `BrowserUp-rest`.
157+
BrowserUp Proxy separates the Embedded Mode and REST API into two modules. If you only need Embedded Mode functionality, add the `BrowserUp-core` artifact as a dependency. The REST API artifact is `BrowserUp-rest`.
202158

203159
If you're using Java and Selenium, the easiest way to get started is to embed the project directly in your test. First, you'll need to make sure that all the dependencies are imported in to the project. You can find them in the *lib* directory. Or, if you're using Maven, you can add this to your pom:
204160
```xml
205161
<dependency>
206162
<groupId>com.browserup.bup</groupId>
207163
<artifactId>browserup-proxy-core</artifactId>
208-
<version>2.1.4</version>
164+
<version>1.0.0/version>
209165
<scope>test</scope>
210166
</dependency>
211167
```
@@ -258,9 +214,9 @@ BrowserUp Proxy makes it easy to use a proxy in Selenium tests:
258214
created by `createSeleniumProxy()` to point to the hostname of the machine that your test is running on. You can also run a standalone
259215
BrowserUp Proxy instance on a separate machine and configure the Selenium Proxy object to use that proxy.
260216

261-
#### 2.1.0+ (LittleProxy) interceptors
217+
#### (LittleProxy) interceptors
262218

263-
There are four new methods to support request and response interception in LittleProxy:
219+
There are four methods to support request and response interception in LittleProxy:
264220

265221
- `addRequestFilter`
266222
- `addResponseFilter`
@@ -300,7 +256,7 @@ For most use cases, including inspecting and modifying requests/responses, `addR
300256
});
301257
```
302258

303-
With Java 8, the syntax is even more concise:
259+
With Java 8, the syntax is more concise:
304260
```java
305261
proxy.addResponseFilter((response, contents, messageInfo) -> {
306262
if (/*...some filtering criteria...*/) {
@@ -337,36 +293,20 @@ Javascript response filters have access to the variables `response` (type `io.ne
337293
curl -i -X POST -H 'Content-Type: text/plain' -d "contents.setTextContents('<html><body>Response successfully intercepted</body></html>');" http://localhost:8080/proxy/8081/filter/response
338294
```
339295

340-
#### Legacy interceptors
341-
342-
If you are using the legacy ProxyServer implementation, you can manipulate the requests like so:
343-
```java
344-
BrowserUpProxy server = new ProxyServer();
345-
((LegacyProxyServer)server).addRequestInterceptor(new RequestInterceptor() {
346-
@Override
347-
public void process(BrowserUpHttpRequest request, Har har) {
348-
request.getMethod().removeHeaders("User-Agent");
349-
request.getMethod().addHeader("User-Agent", "Bananabot/1.0");
350-
}
351-
});
352-
```
353-
<a name="interceptorsRESTapiLegacy"></a>You can also POST a JavaScript payload to `/:port/interceptor/request` and `/:port/interceptor/response` using the REST interface. The functions will have a `request`/`response` variable, respectively, and a `har` variable (which may be null if a HAR isn't set up yet). The JavaScript code will be run by [Rhino](https://github.com/mozilla/rhino) and have access to the same Java API in the example above:
354-
355-
[~]$ curl -X POST -H 'Content-Type: text/plain' -d 'request.getMethod().removeHeaders("User-Agent");' http://localhost:8080/proxy/8081/interceptor/request
356-
357-
Consult the Java API docs for more info.
358-
359296
### SSL Support
360297

361-
**BrowserUp Proxy 2.1.0+ now supports full MITM:** For most users, MITM will work out-of-the-box with default settings. Install the [ca-certificate-rsa.cer](/browserup-proxy-core/src/main/resources/sslSupport/ca-certificate-rsa.cer) file in your browser or HTTP client to avoid untrusted certificate warnings. Generally, it is safer to generate your own private key, rather than using the .cer files distributed with BrowserUp Proxy. See the [README file in the `mitm` module](/mitm/README.md) for instructions on generating or using your own root certificate and private key with MITM.
298+
**BrowserUp Proxy supports full MITM:** For most users, MITM will work out-of-the-box with default settings. Install the [ca-certificate-rsa.cer](/BrowserUp-core/src/main/resources/sslSupport/ca-certificate-rsa.cer) file in your browser or HTTP client to avoid untrusted certificate warnings. Generally, it is safer to generate your own private key, rather than using the .cer files distributed with BrowserUp Proxy. See the [README file in the `mitm` module](/mitm/README.md) for instructions on generating or using your own root certificate and private key with MITM.
362299

363300
**Note: DO NOT** permanently install the .cer files distributed with BrowserUp Proxy in users' browsers. They should be used for testing only and must not be used with general web browsing.
364301

365302
If you're doing testing with Selenium, you'll want to make sure that the browser profile that gets set up by Selenium not only has the proxy configured, but also has the CA installed. Unfortunately, there is no API for doing this in Selenium; it must be done manually for each browser and environment.
366303

367304
### NodeJS Support
368305

369-
NodeJS bindings for browswerup-proxy are available [here](https://github.com/zzo/BrowserUp-node). Built-in support for [Selenium](http://seleniumhq.org) or use [CapserJS-on-PhantomJS](http://casperjs.org) or anything else to drive traffic for HAR generation.
306+
We are compatible with the browsermob proxy, so you could probably fork this and get it going
307+
[https://www.npmjs.com/package/browsermob-proxy-api]
308+
309+
370310

371311
### Logging
372312

0 commit comments

Comments
 (0)