Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

The middleware examples with proxy-by-url do not work for my config #86

Closed
digitalrinaldo opened this Issue Aug 8, 2011 · 4 comments

Comments

Projects
None yet
2 participants

Hi,

url-middleware.js
url-middleware2.js

and the example at the proxy-by-url workspace

/private/tmp/http-proxy/1.js:18
});
^

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected token ;
at Module._compile (module.js:397:25)
at Object..js (module.js:408:10)
at Module.load (module.js:334:31)
at Function._load (module.js:293:12)
at Array. (module.js:421:10)
at EventEmitter._tickCallback (node.js:126:26)

I can't seem to get this example

require('http-proxy').createServer(
require('proxy-by-url')({
'/database': { port: 5984, host: 'localhost' },
})
).listen(8000)

or the url-middleware.js example to work with node I am getting a
unexpected token

m1:node rinaldo$ node url-middleware.js

/opt/node/url-middleware.js:44
});
^

m1:node rinaldo$ npm info proxy-by-url
{ name: 'proxy-by-url',
description: 'custom logic for node-http-proxy to proxy basedon incoming
url',
'dist-tags': { latest: '0.0.0' },
versions: '0.0.0',
maintainers: 'dominictarr dominic.tarr@gmail.com',
time: { '0.0.0': '2011-07-30T09:55:29.217Z' },
author: 'Dominic Tarr dominic.tarr@gmail.com (
http://bit.ly/dominictarr)',
repository:
{ type: 'git',
url: 'git://github.com/dominictarr/proxy-by-url.git' },
version: '0.0.0',
homepage: 'http://github.com/dominictarr/proxy-by-url',
dependencies: {},
devDependencies: {},
scripts: { test: 'meta-test test/.js' },
engines: { node: '
' },
dist:
{ shasum: 'ee8c04d31d20996e7d4a4ce888379890119a73ea',
tarball: '
http://registry.npmjs.org/proxy-by-url/-/proxy-by-url-0.0.0.tgz' },
directories: {} }

Reply to this email directly or view it on GitHub:
http://github.com/inbox/11305033#reply

Contributor

dominictarr commented Aug 9, 2011

uh, this is a syntax error in /private/tmp/http-proxy/1.js

this looks like a missing { or (
or possibly a comment //
on the last line, or an unclosed block comment. /*

it looks like the way you have your enviroment setup is very odd.

have a look in /private/tmp/http-proxy/1.js

also, there was a mistake in proxy-by-url please install the new version. (then your pasted code will work)

Contributor

dominictarr commented Aug 9, 2011

sorry, I just realized that you had already emailed me about this.

please install/pull the new version and also cd examples && npm install

also fixed a small mistake in proxy-by-url, now it's at 0.0.1

this should work now, please confirm.

Works on my mac with 0.4.9 fails on 4.11-pre on centos

Contributor

dominictarr commented Aug 10, 2011

cool, thanks.

will check this again when 0.4.11 is offically released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment