Как открыть в CGI доступ к переменым веб сервера apach? к примеру HTTP_AUTHORIZATION
Искал информацию почему HTTP_AUTHORIZATION = nil пришел к выводу, что apach не передает некоторые переменные CGI скрипту. Так вот как передать их скрипту ?
Искал решение, но в моем apach не работает.
<IfModule alias_module>
#
# Redirect: Allows you to tell clients about documents that used to
# exist in your server's namespace, but do not anymore. The client
# will make a new request for the document at its new location.
# Example:
# Redirect permanent /foo http://www.example.com/bar
#
# Alias: Maps web paths into filesystem paths and is used to
# access content that does not live under the DocumentRoot.
# Example:
# Alias /webpath /full/filesystem/path
#
# If you include a trailing / on /webpath then the server will
# require it to be present in the URL. You will also likely
# need to provide a <Directory> section to allow access to
# the filesystem path.
#
# ScriptAlias: This controls which directories contain server scripts.
# ScriptAliases are essentially the same as Aliases, except that
# documents in the target directory are treated as applications and
# run by the server when requested rather than as documents sent to the
# client. The same rules about trailing "/" apply to ScriptAlias
# directives as to Alias.
#
#ScriptAlias /cgi-bin/ "/srv/httpd/cgi-bin/"
Alias /cgi-bin /var/www/cgi-bin
#Alias /cgit /var/www/htdocs/cgit
<Directory /var/www/cgi-bin>
#<Directory /var/www/htdocs/cgit/>
AddHandler cgi-script .cgi .lua
Options ExecCGI
Require all granted
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
//тут потом переставлял по разному такой пример.
RewriteCond %{HTTP_AUTHORIZATION} !-f
RewriteCond %{HTTP_AUTHORIZATION} !-d
Header set Access-Control-Allow-Origin "*"
RewriteRule ^(.*)$ index.php/$1 [L]
//но без успешно
</Directory>
// и сюда пытался вставить пример
</IfModule>
При перезапуске сервера выдает ошибку
Invalid command 'RewriteRule', perhaps misspelled or defined by a module not included in the server configuration
sudo a2enmod rewrite a2enmod не найден
дистрибутив slackware 15
Ответы (1 шт):
https://support.deskpro.com/en/kb/articles/missing-authorization-headers-with-apache Здесь нашел ответ.
Нужно добавить строку
SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
Я не использую PHP, но мне в CGI пришла переменная окружения с именем HTTP_AUTHORIZATION