Skip to content


Subversion checkout URL

You can clone with
Download ZIP


proxies to "localhost" virtual host #303

omares opened this Issue · 1 comment

3 participants



shouldnt following snippet proxy every request made to localhost:8000 to my local nginx virtual host which runs under the domain "auth-request"? I am asking this because all request get forwarded to the default "localhost/" virtual host. It seems that the request gets forwarded to the ip but the hostname is discarded?

var http = require('http'),
    httpProxy = require('http-proxy');

// Create a proxy server with custom application logic
httpProxy.createServer(function (req, res, proxy) {
  // Put your custom server logic here
  proxy.proxyRequest(req, res, {
    host: 'auth-request',
    port: 80

@omares by default http-proxy doesn't change the Host header to the targeted hostname, so Nginx doesn't know which host to match to.
You can force it by setting the changeOrigin option to true.

@indexzero indexzero closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.