mod_rewrite 和服务器环境变量

发布于 2024-09-26 09:16:23 字数 434 浏览 7 评论 0原文

我的设置如下:

我有一个 Apache 服务器作为 URL 重写引擎 (SERVER1)。

我有第二个服务器(也是 Apache),它运行一个 Web 应用程序(SERVER2)。首先尝试对用户进行身份验证。身份验证协议的一部分涉及应用程序服务器和身份验证服务器之间的大量重定向。

我的问题是,一旦身份验证成功,身份验证服务器需要将用户重定向回应用程序服务器,该服务器仅在 SERVER1 上可见。实际上,SERVER2 需要能够根据 SERVER1 的参数重建 URL。

大多数环境变量都很有帮助,即我知道主机名、脚本名称、名为 etcc 的页面,但我无法确定调用是通过 HTTP 还是 HTTPS 进行的:该信息在 SERVER1 的重写过程中被擦除...

有人知道我是否/如何通过环境变量获取该信息?我受到限制,无法使用查询字符串参数...

谢谢大家!

The setup I have is as follows:

I have one Apache server acting as a URL rewriting engine (SERVER1).

I have a second server (Apache too) which runs a web application (SERVER2). First tries to authenticate users. Part of the authentication protocol involves a lot of redirection between that application server and the authentication server.

My problem is that once the authencation is successfull, the authentication server needs to redirect the user back to the application server, which is only visible from SERVER1. Effectively, SERVER2 needs to be able to reconstruct a URL based on SERVER1's parameters.

Most of the environement variable are helpful i.e. I know the host name, script name, page called etcc but I can 't figure out wether the call was made through HTTP or HTTPS: that information is wiped in the rewrite process by SERVER1...

Anybody knows if/how I can get that information through environement variables? I am limited in that I can't use query string parameters...

Thanks all !

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

云之铃。 2024-10-03 09:16:24

这听起来可能很奇怪,但我已经找到了我的问题的部分答案。

重写引擎(至少在 Apache 2 中,我没有在其他地方看过)允许写入额外的请求标头。

规则应该看起来像这样。

重写规则.* -
[E=INFO_PATH_INFO:%{PATH_INFO},NE]

简单来说,它创建一个名为 INFO_PATH_INFO 的新标头,并将值设置为 PATH_INFO。
(有关更多信息,请查看 http://www.askapache.com/htaccess /crazy-advanced-mod_rewrite-tutorial.html )

然后可以用任何语言检索它。
作为信息,我正在使用 Oracle 的 OWA,它增加了额外的复杂性,因为默认环境变量仅限于少数几个,并且需要在 thr Dads.conf 中指定其他变量

希望这对任何人都有帮助!

This may sound strange, but I have found part of the answer to my question.

The rewrite engine (at least in Apache 2, I haven't looked anywhere else) allows for writting extra request header.

The rule should look something like that.

RewriteRule .* -
[E=INFO_PATH_INFO:%{PATH_INFO},NE]

Put simple, it creates a new header called INFO_PATH_INFO and sets the value to PATH_INFO.
( For more info check out http://www.askapache.com/htaccess/crazy-advanced-mod_rewrite-tutorial.html )

Then it can be retrieved in any languages.
For info I am using Oracle's OWA which adds an extra layer of complication due to the fact that the default environment variables are limited to a few and additional variables need to be specified in thr dads.conf

Hope this will help anyone !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文