代理http请求与节点 [英] proxy http request with node

查看:470
本文介绍了代理http请求与节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个域上有一个nodeJs前端,在另一个域上有一个后端服务器。



我想能够从前面执行ajax请求到后面。因此,我打算使用反向代理,为了绕过相同的源策略限制。



我的后端Rest服务器将使用基本验证或OAuth 。我想知道,如果我使用node-http-proxy如果在代理它之前可以在http请求中发送授权头,以及如何。



谢谢很多。

解决方案

有很多方法可以实现这一点:





最好的问候, p>

I have a nodeJs front end on one domain and a rest back end server on another domain.

I would like to be able to perform ajax requests from the front to the back. So, i intend to use a reverse proxy for that, in order to bypass the same origin policy restriction.

My back end Rest server will be secured with Basic auth or OAuth. I would like to know, if i use node-http-proxy if it is possible to send an Authorization header in the http request before proxying it, and how.

Thanks a lot.

解决方案

You have plenty of ways to accomplish that:

Best Regards,

这篇关于代理http请求与节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆