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

Can I use a proxy for my proxy? #292

Open
pselden opened this issue Oct 25, 2017 · 3 comments
Open

Can I use a proxy for my proxy? #292

pselden opened this issue Oct 25, 2017 · 3 comments

Comments

@pselden
Copy link

pselden commented Oct 25, 2017

I'm using this to proxy to some resources in my application that are internal to my company's network, but in order to access external resources, I have to go through ANOTHER proxy. Is there a way to tell this to use a proxy itself?

@monkpow
Copy link
Collaborator

monkpow commented Nov 13, 2017

@pselden I probably need a little more information about your case. I'm not sure if you're talking about switching the target proxy server based on URL, or if you also want to run express-http-proxy on another server as well, or perhaps another case. If you want to flesh out some more details, I'll try to help you with a solution.

@pselden
Copy link
Author

pselden commented Nov 13, 2017

My setup is such:

  1. Client makes API requests to the same server that static files are hosted from: EX: /users/1, /posts/1
  2. posts and users are actually small microservices hosted at different endpoints, so I am using express-http-proxy to route requests to the appropriate spot (I also apply some authentication logic in front of it. EX: /users/* gets proxied to http://users.mycompany.com/1 and /posts/1 gets proxied to http://posts.mycompany.com/1 (just an example, not actually how it's set up!). posts.mycompany.com and users.mycompany.com are not reachable by the public internet, they are only accessible by the internal network (where my http-proxy is hosted).
  3. There is another endpoint, /cars/1, which has the same setup except that it proxies to http://some.public.resource.com/cars/1 -- which IS on the public internet is as not hosted in the same way that the other services are.
  4. There are company firewall rules preventing outbound traffic to non-internal services, so that proxying to http://some.public.resource.com/cars/1 does NOT work. We have another proxy service (proxy.mycompany.com) that is designed for communicating with external services. So in order to get my request to work, I actually have to have my express-http-proxy actually call this proxy to communicate with http://some.public.resource.com/cars/1 successfully.

So in order to support point 4, I think I need some way to tell it that I actually need to use a proxy for this given resource.

Note: I was able to work around this by just rewriting the request to set the host to my proxy server and the path to the full url... but I think this is kind of a workaround.

@d0x
Copy link

d0x commented Nov 17, 2017

I have the same problem. Would be nice if #286 gets merged

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

No branches or pull requests

3 participants