httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chaitanya Govande <chint...@gmail.com>
Subject [users@httpd] IF request_uri regex syntax
Date Wed, 16 May 2018 19:22:58 GMT
Hello,

Trying to check the request uri against a regex in an IF directive.
This IF directive is located inside a <Location> tag.

Following is the code:

<If "%{REQUEST_URI} =~ /manager/status/ && %{HTTP_USER_AGENT} =~
/Chrome/ && %{QUERY_STRING} =~
/org.apache.catalina.filters.CSRF_NONCE=.*/">

AddOutputFilterByType INFLATE;SUBSTITUTE;DEFLATE text/html

</If>

However, when trying to restart apache, I get the following:

May 16 19:20:53 apache.localdomain systemd[1]: Starting The Apache
HTTP Server...
May 16 19:20:54 apache.localdomain httpd[2586]: AH00526: Syntax error
on line 21 of /etc/httpd/test/test.conf:
May 16 19:20:54 apache.localdomain httpd[2586]: Cannot parse condition
clause: syntax error, unexpected T_ID, expecting $end
May 16 19:20:54 apache.localdomain systemd[1]: httpd.service: main
process exited, code=exited, status=1/FAILURE
May 16 19:20:55 apache.localdomain kill[2588]: kill: cannot find process ""
May 16 19:20:55 apache.localdomain systemd[1]: httpd.service: control
process exited, code=exited status=1
May 16 19:20:55 apache.localdomain systemd[1]: Failed to start The
Apache HTTP Server.
May 16 19:20:55 apache.localdomain systemd[1]: Unit httpd.service
entered failed state.
May 16 19:20:55 apache.localdomain systemd[1]: httpd.service failed.

I can get it to work if I do a string compare (==) but I would like to
do it against a regex statement but just can't seem to figure out the
correct syntax.

Any help is appreciated.

Thank you,

Chaitanya Govande

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message