Skip to content

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

New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@digitalrinaldo
Copy link

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 [email protected]',
time: { '0.0.0': '2011-07-30T09:55:29.217Z' },
author: 'Dominic Tarr [email protected] (
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

@dominictarr
Copy link
Contributor

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)

@dominictarr
Copy link
Contributor

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.

@digitalrinaldo
Copy link
Author

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

@dominictarr
Copy link
Contributor

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants