Skip to content
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

Problems with simple reverse proxy #1179

Open
AndersML opened this issue Jun 7, 2017 · 4 comments
Open

Problems with simple reverse proxy #1179

AndersML opened this issue Jun 7, 2017 · 4 comments

Comments

@AndersML
Copy link

AndersML commented Jun 7, 2017

Hi, I want to do something similar to
https://support.rstudio.com/hc/en-us/articles/200552326-Running-RStudio-Server-with-a-Proxy

but with node-http-proxy.

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


var proxy = new httpProxy.createProxyServer({
  target: {
    host: '10.10.10.10',  // fake ip of cause
    port: 8787,
    hostRewrite: true,
    autoRewrite: true,
    protocolRewrite: true,
    httpVersion: '1.0'
  }
});

var proxyServer = http.createServer(function (req, res) {
  proxy.web(req, res);
});

// Listen to the `upgrade` event and proxy the
proxyServer.on('upgrade', function (req, socket, head) {
  proxy.ws(req, socket, head);
});

proxyServer.listen(80);

This almost work, but I get a error when signing into the Rstudio server. It works fine using the nginx proxy from the link above. Does anybody known what I am doing wrong?

I have used node-http-proxy for other project without problem, an I really like the versatility of the system!

Best
Anders ML

@mwcz
Copy link

mwcz commented Sep 20, 2017

I'm not sure if this is your problem or not, but I'm pretty sure protocolRewrite should be set to either 'http' or 'https'.

@dinvlad
Copy link

dinvlad commented Jul 8, 2018

@AndersML have you been able to resolve this issue?

@rv2e
Copy link

rv2e commented Nov 29, 2018

@AndersML I'm encountering exactly the same issue with Rstudio server. Have you found a fix?

@AndersMoelbjerg
Copy link

I was not able to resolve it. I changed proxy to nginx instead, where I used some Lua code to do the special logic I needed

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

5 participants