Skip to content

Commit cdf9bbb

Browse files
author
Karl Stanton
committed
First commit
1 parent 2c0ac63 commit cdf9bbb

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Run Google Page Speed against Websites that are behind Basic Authentication.
2+
3+
This is a nifty way to test environments that are live, but live behind Basic Authentication.
4+
5+
## Installation
6+
7+
1. Download [ngrok](http://ngrok.com).
8+
1. Install this node application
9+
10+
## Configuration
11+
12+
For a user `admin` with the password `admin` at http://staging.mywebsite.com`, you would update the following:
13+
14+
1. Edit `proxy.js` and rename the following placeholders
15+
1. `<your website>` to `http://staging.mywebsite.com`
16+
1. `<your username>` to `admin`
17+
1. `<your password>` to `admin`
18+
19+
## Usage
20+
21+
1. `$ npm i` (server will now be running on `localhost:3000`)
22+
1. Run ngrok: `$ ngrok http localhost:3000` which spins up an ngrox proxy to localhost (which points to your website)
23+
1. Copy the URL in the first "Forwarding" propery below.
24+
1. Paste it in this page - https://developers.google.com/speed/pagespeed/insights/
25+
26+
```
27+
Tunnel Status online
28+
Update update available (version 2.1.18, Ctrl-U to update)
29+
Version 2.0.25/2.1.18
30+
Region United States (us)
31+
Web Interface http://127.0.0.1:4040
32+
Forwarding http://xxxxxxxx.ngrok.io -> localhost:3000
33+
Forwarding https://xxxxxxxx.ngrok.io -> localhost:3000
34+
35+
Connections ttl opn rt1 rt5 p50 p90
36+
0 0 0.00 0.00 0.00 0.00
37+
```

package.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "page-speed-proxy",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "proxy.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1"
8+
},
9+
"keywords": [],
10+
"author": "learntoswim",
11+
"license": "ISC",
12+
"devDependencies": {
13+
},
14+
"dependencies": {
15+
"express": "^4.14.1",
16+
"http-proxy-middleware": "^0.17.3"
17+
}
18+
}

proxy.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var express = require('express');
2+
var proxy = require('http-proxy-middleware');
3+
4+
var app = express();
5+
6+
app.use('/', proxy({
7+
target: '<your website>',
8+
auth: '<your username>:<your password>',
9+
changeOrigin: true,
10+
}));
11+
12+
app.listen(3000);

0 commit comments

Comments
 (0)