Intercept webpages to add or remove Sitecues.
- Enables testing on potential and existing customer sites.
- Reliable simulation, happening at the network layer.
- Powerful and easy to use.
As a dependency:
npm install sitecues/sitecues-proxy --save
As a project to work on:
git clone [email protected]:sitecues/sitecues-proxy.git &&
cd sitecues-proxy &&
npm link
$ proxy --help
Usage
$ proxy
Option
--port <number> Listen on a custom port for requests.
--open <url> Open a URL in your browser.
--loader <string> Code to inject into HTML responses.
--loaderFile <path> Filepath to find a loader.
--loaderStrategy <string> What to do with loaders.
--logLevel <level> Amount of program info to output.
Example
$ proxy
The Sitecues® Proxy is on port 8000.
$ proxy --port=8888
The Sitecues® Proxy is on port 8888.
Control how quiet or noisy the proxy logs are. Uses npm levels, possible values are error
, warn
, info
, verbose
, debug
, silly
.
$ proxy --logLevel=debug
The following options control the Sitecues loader added to pages. They do not control the proxy itself.
Load a specific branch.
$ proxy --branch=master
Load a specific version.
$ proxy --build=1.0.0
Imitate a specific customer.
$ proxy --siteId=s-0000ee0c
Load from a specific server.
$ proxy --jsHost=localhost
Type: object
Settings for the new proxy instance.
Type: number
Default: 8000
The port number to listen on for requests.
Type: string
A piece of code to inject into webpages. Takes precedence over loaderFile
.
Type: string
Default: config/loader.html
A filepath to find a loader, when loader
is not provided.
Type: string
Default: replace
What to do with loaders that are provided and ones that are encountered on webpages.
Strategy | Description |
---|---|
add |
Always inject the provided loader, no matter what. |
remove |
Simply remove any loaders on the page and do nothing else. |
keep |
Inject the provided loader only if the page does not have one. |
replace |
Ensure the page loads with only the provided loader. |
Listen for requests.
Stop the proxy from listening.
See our contributing guidelines for more details.
- Fork it.
- Make a feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request.
Copyright © Sitecues. All rights reserved.