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

Need help with proxy configuration to avoid redirects #512

andrei-khveras opened this Issue Nov 6, 2013 · 1 comment


None yet
2 participants

Hi, guys!

I have been struggling with http-proxy for a couple of days already and I'd appreciate it much if one of you could help me to configure it properly.

What I am doing is I am trying to create an open-source framework for UI testing based on Karma+Jasmine+FuncUnit. To make JavaScript able to make interactions on pages (e.g., driving elements) I need to proxy these pages to localhost first (due to Same Origin Policy restrictions).

I tried to do that using included in Karma proxying, but then found out that it doesn't work fine for many https pages (e.g., for https://www.ozon.ru/context/cart/). When I open this page via proxy (e.g., as localhost:9001/context/cart/), browser gets redirected to a real url (https://www.ozon.ru/context/cart/).

I hope, http-proxy will help me to avoid this problem, but now (after carefull reading of documentation) I am still running into difficulties with http-proxy configuration. I'd like to run my proxy from the command line, or, better, using a config file. The problem is I can't figure out the correct arguments to proxy (forward) pages and subpages from https://www.ozon.ru to, for example, localhost:9001. Would you, please, help me to create a configuration file? Will http-proxy help me to avoid "redirecting proxied https urls to the original" issue described above?

Looking forward to your reply

+1 I was having the same problem. Ended by writing this small proxy server in Node.js that makes use of requests's followRedirect option. Sharing the code in this gist if it could come in handy for you:

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