使用网络服务器插件在到达浏览器之前修改来自网络服务器的 html 响应?
问题就像标题一样简单。我有一个网络应用程序(我不知道它是基于什么技术构建的或它在什么应用程序服务器上运行)。但是,我确实知道该 Web 应用程序由 Apache 服务器/ IIS 服务器/IBM Http 服务器提供服务。现在,我想在网络服务器端有一个插件/模块/附加组件,它将解析/截断/剪切/正则表达式http响应(基于请求的url的模式)和掩码(加密/洗牌/替换)此响应中基于不同参数(用户在 Intranet 中的 LDAP 权限/用户的地理位置(如果在 Internet 上)等)的一组字段,并将更改后的响应发送回用户。
那么,创建此类插件/模块/附加组件是否有一个简单的答案?当您想在不修改 Web 应用程序代码的情况下屏蔽 Web 应用程序中的敏感信息时,这种在 Web 服务器上创建额外软件的方法有多可行?有没有任何工具可以帮助您为 Apache 执行此操作?
最后,这真的是一件疯狂的尝试吗?!
The question is as simple as the title. I have a webapp (I have no clue as to what technology it was built on or what appserver it is running on). However, I do know that this webapp is being served by an Apache Server/ IIS Server / IBM Http Server. Now, I would like to have a plugin/ module / add-on at the web-server end, which would parse/truncate/cut/regex the http response (based on the requested url's pattern), and mask(encrypt/shuffle/substitute) a set of fields in this response based on different parameters(user's LDAP permissions in the intranet / user's geo-location if on the internet, etc) and send the altered response back to the user.
So, Is there an easy answer to creating such plugins/modules/add-ons? How feasible is this approach of creating extra software at the webserver, when you want to mask sensitive information in a webapp without modfying the web-app code? Are there any tools that help you do this for Apache?
And, finally, is this just a really crazy thing to try?!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
每个网络服务器都有自己的这样做的方式。
网络服务器没有通用的插件架构。
在 IIS 中,您可以编写 HTTP 处理程序 或HTTP 模块,或者可能是 ISAPI 过滤器。您还可以使用 响应由 HttpContext。
使用 apache,有不同的模块可以执行您想要的操作(mod_headers,例如)。
我对WebSphere一无所知,但我确信它也有类似的机制。
大多数网络应用程序都需要您所要求的内容,因此要么是内置的,要么很容易做到。
Each webserver will have its own way of doing so.
There is no universal plugin architecture for webservers.
In IIS you would write an HTTP Handler or HTTP Module, or possibly an ISAPI Filter. You can also directly interact with the http response using the Response object exposed by the HttpContext.
With apache, there are different modules that can do what you want (mod_headers, for example).
I don't know anything about WebSphere, but I am certain it also has similar mechanisms.
What you are asking is required by most web applications, so would be either built in or very easy to do.
最简单的方法是使用 Web 应用程序容器添加插件。例如,如果是Tomcat,则可以添加过滤器或阀门。
如果您想插入 Web 服务器,则需要使用正在使用的 Web 服务器的 API 编写自定义模块。
如果一切都失败了,您始终可以将整个服务器包装在反向代理中。所有请求都将通过您的代理,这将使您有机会修改请求和响应。
The easiest way is to add a plug-in using the web application container. For example, if it's Tomcat, you can add a filter or valve.
If you want to plug-in to the web server, you'd need to write a custom module using the API of whichever web server is being used.
If all else fails, you could always wrap the entire server in a reverse proxy. All requests would go through your proxy and that would give you the opportunity to modify the requests and the responses.