如何使apache执行脚本并在httpd-ssl.conf中将输出用作变量

时间:2017-09-06 01:35:47

标签: apache shell variables set

我在RedHat 7.x上运行 apache 2.4

https 虚拟主机部分

AttributeError: 'Word2Vec' object has no attribute 'syn1'

然而,当我在我的网络服务器上打电话时,我希望能够执行 shell脚本会调用 Cookie ,基本上它会动态提供 some_long_cookie_string

当它被硬编码时,它可以工作。

...

<VirtualHost _default_:8082>

DocumentRoot "/some/location/httpd2_4_27/htdocs"
ServerName some_url:8082
...
...

# RewriteMap elastic_cookies "prg:/some/location/get_cookies.sh"
# SetEnv ELASTIC5 %{elastic_cookies}e


SetEnv ELASTIC5 "some_long_cookie_string"

RequestHeader set Cookie "SSOLogin=badcookie; SSOCookie=%{ELASTIC5}e"

ProxyPass / https://my.web/o/rest/user
ProxyPassReverse / https://my.web/o/rest/user

</VirtualHost>

在我看来,我需要的是这样的东西,但它不起作用:

SetEnv ELASTIC5 "some_long_cookie_string"

我的目标是调用 get_cookies.sh 脚本和输出 - &gt;每次调用apache都会动态设置 some_long_cookie_string

任何想法??????????????

1 个答案:

答案 0 :(得分:0)

下面粘贴了如何在Apache 2.4配置中使用变量的答案 详细解释可以在这个博客上找到 https://linuxinuse.com/devopsbloghttps://linuxinuse.com/devopsblog/make-heartbeat-5-use-ssocookies-authentication-method-leveraging-apache-2-4-proxy-dynamically-loaded-ssocookies-variable/

Listen 8000
...
SSLProxyEngine on
RewriteEngine On
RewriteMap elastic_cookies "txt:/opt/apache/httpd_2.4/up_to_date_cookie.txt"
RewriteRule (.*) - [E=ELASTIC5:${elastic_cookies:my_cookies},P]
RequestHeader set Cookie "SSOLogin=badcookie; SSOCookie=%{ELASTIC5}e"
ProxyPass /end_point http://www.endpoint.com
ProxyPassReverse /end_point http://www.endpoint.com
ProxyPass /other_end_point http://www.other_end_point.com
ProxyPassReverse /other_end_point http://www.other_end_point.com
</VirtualHost>