aliyun-docker-https
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "aliyun-docker-https", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Http to https for aliyun docker.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,6 +0,6 @@ | ||
# ip-checker | ||
Check client ip for koa & express. | ||
# aliyun-docker-https | ||
Http to https for aliyun docker. | ||
# Quick Start | ||
* `npm install ip-checker` to install `ip-checker`; | ||
* `npm install aliyun-docker-https` to install `aliyun-docker-https`; | ||
* express | ||
@@ -11,8 +11,10 @@ | ||
var express = require('express') | ||
, app = express(); | ||
app.use(require('ip-checker')({ | ||
default: 'x', | ||
allow: ['127.0.0.1'] | ||
, app = express() | ||
app.use(require('./index.js')({ | ||
ignore: ['/test/url$'] | ||
})); | ||
app.listen(3000) | ||
console.log('express listen on 3000.') | ||
@@ -24,7 +26,5 @@ ``` | ||
var app = require('koa')() | ||
app.use(require('ip-checker')({ | ||
default: 'x', | ||
allow: ['127.0.0.1'], | ||
mode: 'koa' | ||
})) | ||
app.use(require('./index.js')({ | ||
ignore: ['/test/url$'] | ||
})); | ||
app.listen(3000) | ||
@@ -35,4 +35,11 @@ ``` | ||
```bash | ||
curl -H 'x-forwarded-for: 127.0.0.2' -i http://localhost:3000/ | ||
curl -H 'x-forwarded-for: 127.0.0.1' -i http://localhost:3000/ | ||
// 302 | ||
curl -H 'x-forwarded-proto: http' -i http://localhost:3000/ | ||
curl -H 'x-forwarded-proto: http' -i http://localhost:3000/test/urla | ||
curl -H 'x-forwarded-proto: http' -i http://localhost:3000/test/urla?a=a | ||
// 404 | ||
curl -H 'x-forwarded-proto: https' -i http://localhost:3000/ | ||
curl -H 'x-forwarded-proto: https' -i http://localhost:3000/test/url | ||
curl -H 'x-forwarded-proto: http' -i http://localhost:3000/test/url | ||
``` | ||
@@ -39,0 +46,0 @@ |
5179
50