From e8202aa31fde69c52228572fbbab10ded9c70578 Mon Sep 17 00:00:00 2001 From: Rob Wu Date: Wed, 6 May 2015 18:20:11 +0200 Subject: [PATCH] Add more xfwd tests (https+http & http+https) --- test/test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/test.js b/test/test.js index 8557d4e..2403bf9 100644 --- a/test/test.js +++ b/test/test.js @@ -236,6 +236,18 @@ describe('Basic functionality', function() { }, done); }); + it('X-Forwarded-* headers (https)', function(done) { + request(cors_anywhere) + .get('/https://example.com/echoheaders') + .set('test-include-xfwd', '') + .expect('Access-Control-Allow-Origin', '*') + .expectJSON({ + host: 'example.com', + 'x-forwarded-port': '80', + 'x-forwarded-proto': 'http', + }, done); + }); + it('Ignore cookies', function(done) { request(cors_anywhere) .get('/example.com/setcookie') @@ -275,6 +287,18 @@ describe('server on https', function() { stopServer(done); }); + it('X-Forwarded-* headers (http)', function(done) { + request(cors_anywhere) + .get('/example.com/echoheaders') + .set('test-include-xfwd', '') + .expect('Access-Control-Allow-Origin', '*') + .expectJSON({ + host: 'example.com', + 'x-forwarded-port': '443', + 'x-forwarded-proto': 'https', + }, done); + }); + it('X-Forwarded-* headers (https)', function(done) { request(cors_anywhere) .get('/https://example.com/echoheaders')