Apache 作为 CouchDB 的反向代理
我正在考虑一个广泛使用 CouchDB 的 Web 应用程序,尽可能多地使用本机 erlang HTTP API 提供服务会带来巨大收益。
您能否将 Apache 配置为反向代理,以允许外部 GET 直接代理到 CouchDB,而 PUT/POST 发送到应用程序内部逻辑(用于卫生、身份验证...)? 或者这是不明智的——CouchDB 内置身份验证选项对于 Web 应用程序来说似乎有点弱。
谢谢
I'm thinking of a web app that uses CouchDB extensively, to the point where there would be great gains from serving with the native erlang HTTP API as much as possible.
Can you configure Apache as a reverse proxy to allow outside GETs to be proxied directly to CouchDB, whereas PUT/POST are sent to the application internal logic (for sanitation, authentication...)? Or is this unwise -- the CouchDB built-in authentication options just seem a little weak for a Web App.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用
mod_rewrite
根据HTTP方法有选择地代理请求。例如:
任何
POST
、PUT
或DELETE
请求都将由 Apache 照常处理,因此您可以按照自己的方式连接应用程序层通常会。You can use
mod_rewrite
to selectively proxy requests based on the HTTP method.For example:
Any
POST
,PUT
, orDELETE
requests will be handled by Apache as usual, so you can wire up your application tier however you usually would.你看到这个了吗? OAuth 和 cookie 身份验证已于 4 日签入:
http://github.com/halorgium/couchdb /commit/335af7d2a9ce986f0fafa4ddac7fc1a9d43a8678
另外,如果您有兴趣使用 Erlang 作为服务器语言,您可以通过 webmachine 代理 couchdb:
http://blog.beerriot.com/2009/05/18/couchdb-proxy-webmachine-resource/
Did you see this? OAuth and cookie authentication were checked in on the 4th:
http://github.com/halorgium/couchdb/commit/335af7d2a9ce986f0fafa4ddac7fc1a9d43a8678
Also, if you're at all interested in using Erlang as the server language, you could proxy couchdb through webmachine:
http://blog.beerriot.com/2009/05/18/couchdb-proxy-webmachine-resource/
我会考虑使用 Apache mod_proxy 的反向代理功能。 创建一个虚拟主机配置,将 Web 服务器的某些 HTTP 请求转发到 CouchDB。 您可以设置应转发哪些 URI 路径的规则等。
请参阅本指南以获取灵感:http://macgyverdev.blogspot.se/2014/02/apache-web-server-as-reverse-proxy-and.html
I would consider using the reverse proxy feature of Apache mod_proxy. Create a virtual host configuraton that forwards certain HTTP requests of the web server to CouchDB. You can setup rules on which URI paths that should be forwarded etc.
See this guide for inspiration: http://macgyverdev.blogspot.se/2014/02/apache-web-server-as-reverse-proxy-and.html
你的问题已经过时了,没有答案,所以我会添加这个“几乎答案”。
Nginx 绝对可以根据请求进行不同的重定向。
这是,如果您准备将 nginx 放在前端作为 revproxy,并将 apache 和 couchdb 都作为后端。
Your question is aging without answers, so I'll add this "almost answer".
Nginx can definitely redirect differently based on requests.
This is, if you are ready to place nginx in the front as the revproxy and place apache and couchdb both as backends.