Skip to content

Commit c7a4fde

Browse files
committed
proxy now works, needs more tests
1 parent bf6836a commit c7a4fde

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

bin/ldnode.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ var argv = require('nomnom')
5454
help: 'HTTP Session secret key (e.g. "your secret phrase")',
5555
abbr: 's'
5656
})
57+
.option('xssProxy', {
58+
full: 'xss-proxy',
59+
help: 'Use a proxy on example.tld/xssProxyPath',
60+
abbr: 'P'
61+
})
5762
.option('noLive', {
5863
full: 'no-live',
5964
help: 'Disable live support through WebSockets',

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ function ldnode (argv) {
4646
resave: false
4747
}));
4848

49-
// Setting up routes
50-
app.use('/', routes());
51-
5249
// Adding proxy
5350
if (ldp.xssProxy) {
5451
proxy(app, ldp.proxyFilter);
5552
}
5653

54+
// Setting up routes
55+
app.use('/', routes());
56+
5757
// Setup Express app
5858
if (ldp.live) {
5959
ws(app);

test/http.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,18 @@ describe('HTTP APIs', function() {
4343
var address = 'http://localhost:3457';
4444
var ldp = ldnode.createServer({
4545
root: __dirname + '/resources',
46+
xssProxy: '/proxy'
4647
});
4748
ldp.listen(3457);
4849

4950
var server = supertest(address);
5051

52+
describe('Proxy', function() {
53+
it('should return the website in ?uri', function(done) {
54+
server.get('/proxy?uri=http://google.com')
55+
.expect(200, done);
56+
});
57+
});
5158

5259
describe('GET Root container', function() {
5360
it('should have Access-Control-Allow-Origin as the req.Origin', function(done) {

0 commit comments

Comments
 (0)