我在AWS ECS中将Apache作为容器运行。我已启用身份验证,但在部署时由于运行状况检查而失败。以下是我的配置
我的健康检查URL是/subscription/ping?m=5&tab=141046123
。如何从身份验证中排除此URL。
我尝试了Require expr %{REQUEST_URI} =~ m#^/subscription/ping\?m=5&tab=141046123$#
,但没有成功。语法是否有误?
000-默认.conf
<VirtualHost *:80>
ServerName dev-services.mydomain.com
## Vhost docroot
##DocumentRoot "/var/www/html/public"
DocumentRoot "/var/www/services/current/public"
## Directories, there should at least be a declaration for /var/www/html/public
<Directory "/var/www/services/current/public">
Options -Indexes
AllowOverride All
#Require all granted
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
Require expr %{REQUEST_URI} =~ m#^/subscription/ping\?m=5&tab=141046123$#
</Directory>
ServerSignature Off
## Do not log health check url in access log
SetEnvIf Request_URI "^/elbhealthcheck$" healthcheck_url=1
SetEnvIf User-Agent "^ELB-HealthChecker" is_healthchecker=1
SetEnvIf healthcheck_url 0 !is_healthchecker
SetEnvIf is_healthchecker 1 dontlog
LogFormat "{ \"logType\":\"accesslog\", \"time\":\"%{%Y-%m-%d}tT%{%T}t.%{msec_frac}tZ\", \"clientIP\":\"%{X-Forwarded-For}i\", \"remote_hostname\":\"%h\", \"remote_logname\":\"%l\", \"host\":\"%V\", \"request\":\"%U\", \"first_req\":\"%r\", \"query\":\"%q\", \"method\":\"%m\", \"status\":\"%>s\", \"userAgent\":\"%{User-agent}i\", \"referer\":\"%{Referer}i\" }" jsoncombine
ErrorLogFormat "{ \"logType\":\"errorlog\",\"time\":\"%{cu}t\", \"loglevel\" : \"%l\" ,\"module\" : \"%-m\" , \"process_id\" : \"%P\" , \"message\" : \"%M\" }"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log jsoncombine env=!dontlog
</VirtualHost>
1条答案
按热度按时间baubqpgj1#
添加
SetEnvIf User-Agent "^ELB-HealthChecker" let_me_in
和Require env let_me_in
修复了容器的运行状况检查问题