寻找能够拦截静态资源请求的 HTTP 代理
背景
我开发了一个运行在嵌入式设备上的 Web 应用程序。为了使开发时间更加合理,前端开发是使用 apache 提供静态文档来完成的,并使用 PHP 代理到嵌入式设备以获取专门配置的动态资源。这要求我们在源代码管理中保留各种服务器模拟脚本,并且每当我们添加新的动态资源时都需要更新这些脚本。
问题
我想反转逻辑:如果请求的文档在静态文档目录中可用,则提供它;否则,将请求代理到嵌入式设备。
最理想的是,我想要一个能够为我完成此操作的软件包(适用于 Windows 或可在 cygwin 上构建)。我可以强制 apache 使用 PHP 来完成此操作,但我不确定如何配置它以实现它。我看过鱿鱼和 privoxy,但它们似乎都没有达到我想要的效果。
有什么想法吗?我宁愿不必自己动手。
Background
I develop a web application that lives on an embedded device. In order to make dev times sane, frontend development is done using apache serving static documents, with PHP proxying out to the embedded device for specifically configured dynamic resources. This requires that we keep various server-simulation scripts hanging around in source control, and it requires updating those scripts whenever we add a new dynamic resource.
Problem
I'd like to invert the logic: if the requested document is available in the static documents directory, serve it; otherwise, proxy the request to the embedded device.
Optimally, I want a software package that will do this for me (for Windows or buildable on cygwin). I can deal with forcing apache to do it with PHP, but I'm unsure how to configure it to make it happen. I've looked at squid and privoxy, but neither of them seem to do what I want.
Any ideas? I'd rather not have to roll my own.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
现在,Varnish 在 cygwin 中可用,请参阅:
Now, Varnish is available in cygwin, see:
我认为你想要的是 清漆。
I think what you want is varnish.
现在我已经了解了 varnish,我明白我真正想要的是反向代理的特殊情况,并且 squid 可以配置为执行我需要的操作。 (还有一个额外的好处是可以将其作为 cygwin 包使用。)
Now that I've looked at varnish, I understand that what I actually want is a special case of a reverse proxy, and that squid can be configured to do what I need. (With the added bonus of having it available as a cygwin package.)