Apache 内部重写模块用于唯一 URL?
我正在尝试使用以下场景创建一个安全下载 Web 应用程序。任何人都知道如何实现这一点:
1) 为用户提供一个一次性 URL a) 此一次性 URL 存储在映射到实际 URL 的 Oracle DB 中 2)当用户访问一次性URL时: a) Apache 模块连接到数据库以查看一次性 URL 是否存在 b) 如果存在,apache 会内部重写实际的 URL c)如果没有,那么 404 或任何类型的错误(404 或其他错误)就足够了
2.a 和 2.b 是我正在寻找的答案。我不知道如何做到这一点并确保重写在内部发生。
谢谢
I am trying to create a secure download web app with the following scenario. Anybody know how this can be achieved:
1) The user is given a one-time URL
a) This one-time URL is stored in an Oracle DB mapped to the actual URL
2) When the user visits the one-time URL:
a) Apache module connects to the DB to see if the one-time URL exists
b) if it exists, apache does an internal rewrite to the actual URL
c) if not, then 404 or any sort of error (404 or something else) is good enough
2.a and 2.b are the what I am looking answers on. I am not sure how to do this and make sure the rewrites happen internally.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 Apache 主干版本中提供的新 dbd 类型 RewriteMap 功能应该可以实现这一点。显然,这是服务器的当前开发分支,您需要小心随着时间的推移破坏配置的更改。
当然,您将需要一些额外的逻辑来处理没有返回结果的情况。
http://httpd.apache.org/docs/trunk/rewrite/rewritemap .html#dbd
This should be possible using the new dbd-type RewriteMap functionality available in the trunk version of Apache. Obviously with this being the current development branch of the server you'll need to be careful about config-breaking changes over time.
Of course you will need some additional logic for handling cases where no results are returned.
http://httpd.apache.org/docs/trunk/rewrite/rewritemap.html#dbd
AFAIK 仅靠 apache 是不可能实现这一点的。您必须要做的是:
如何实现的具体细节取决于脚本引擎您可以在服务器上使用以及您的偏好。它可以在各种引擎中完成,从 php 到 cgi 到 .NET 到 asp 等等。
AFAIK this is not possible just by apache. What you must want to do is:
The exact details on how to make things happen depends on the scripting engines available to you on the server, and your preferences. It can be done in a variety of engines, from php to cgi to .NET to asp and many others.
想通了...您可以使用 XSEND (https://tn123.org/mod_xsendfile/) 来实现这一点...设置一个 php 脚本来处理任何带有文件下载的 URI,并拒绝对实际文件目录的所有访问,因此唯一的方法是强制通过 XSEND 获取文件的方法。
Figured this out... You can achieve this using XSEND (https://tn123.org/mod_xsendfile/)... Setup a php script to handle any URI's with file download and denied all access to the actual file directory so the only way to get the file it to force it through XSEND.