这个HTTP授权RewriteRule做了什么?

时间:2022-10-06 08:08:30

I have an rewrite recursion error somewhere on my website that Google Bot caused, but I can't find the url that caused it because my Loglevel is low. I raised it but it has not happened again so far.

我在我的网站上有一个重写的递归错误,是谷歌机器人引起的,但是我找不到导致它的url,因为我的日志级别很低。我提出了这个问题,但到目前为止还没有发生。

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

All Rewriterules look fine to me and have the [L] flag, except this one.

所有的Rewriterules对我来说都很好,除了这个,我还有其他的标志。

I can't quite understand it. It is from the open source shop system Magento.

我不太明白。它来自于开源商店系统Magento。

As far as I can tell it does nothing but sets the environment variable E. But isn't that a very stupid way of doing that? Shouldn't you use SetEnv if that was the goal?

就我所知,它除了设置环境变量之外什么都不做,但这难道不是一种非常愚蠢的做法吗?如果那是你的目标,你不应该使用SetEnv吗?

2 个解决方案

#1


7  

This line is setting the environment variable to the value of user authentication string - essentially setting a variable rather than constant value. As far as I know, SetEnv and SetEnvIf only allow you to set an environment variable to a predetermined constant.

这一行是将环境变量设置为用户身份验证字符串的值——实际上是设置一个变量而不是常量值。据我所知,SetEnv和SetEnvIf只允许您将一个环境变量设置为一个预先确定的常量。

The variable being set is actually HTTP_AUTHORIZATION, not E. I would guess this is part of the user authentication process.

设置的变量实际上是HTTP_AUTHORIZATION,不是e,我猜这是用户身份验证过程的一部分。

#2


15  

Symfony developers Group has a good answer for it. I quote:

Symfony开发团队有一个很好的答案。我引用:

it looks like your hosting is running php as a fcgi, not a php5_module, like your localhost does. ( phpinfo - Server API: CGI/FastCGI )

看起来,您的宿主是将php作为一个fcgi而不是php5_module运行,就像您的本地主机一样。(phpinfo -服务器API: CGI/FastCGI)

the point is that php5_module automatically handles HTTP_AUTHORIZATION headers, but fcgi_module does not.

重点是php5_module自动处理HTTP_AUTHORIZATION头,但是fcgi_module没有。

solution is simple - add this line to your .htacces on your hosting server:

解决方案很简单——将这一行添加到您的主机服务器上的.htacces上:

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

RewriteRule。* -[E = HTTP_AUTHORIZATION:% { HTTP:授权},L)

It worked for me

它为我工作

#1


7  

This line is setting the environment variable to the value of user authentication string - essentially setting a variable rather than constant value. As far as I know, SetEnv and SetEnvIf only allow you to set an environment variable to a predetermined constant.

这一行是将环境变量设置为用户身份验证字符串的值——实际上是设置一个变量而不是常量值。据我所知,SetEnv和SetEnvIf只允许您将一个环境变量设置为一个预先确定的常量。

The variable being set is actually HTTP_AUTHORIZATION, not E. I would guess this is part of the user authentication process.

设置的变量实际上是HTTP_AUTHORIZATION,不是e,我猜这是用户身份验证过程的一部分。

#2


15  

Symfony developers Group has a good answer for it. I quote:

Symfony开发团队有一个很好的答案。我引用:

it looks like your hosting is running php as a fcgi, not a php5_module, like your localhost does. ( phpinfo - Server API: CGI/FastCGI )

看起来,您的宿主是将php作为一个fcgi而不是php5_module运行,就像您的本地主机一样。(phpinfo -服务器API: CGI/FastCGI)

the point is that php5_module automatically handles HTTP_AUTHORIZATION headers, but fcgi_module does not.

重点是php5_module自动处理HTTP_AUTHORIZATION头,但是fcgi_module没有。

solution is simple - add this line to your .htacces on your hosting server:

解决方案很简单——将这一行添加到您的主机服务器上的.htacces上:

RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

RewriteRule。* -[E = HTTP_AUTHORIZATION:% { HTTP:授权},L)

It worked for me

它为我工作