Bug 1343582

Summary: Support sending http 451 status code from RewriteRule
Product: Red Hat Enterprise Linux 7 Reporter: Dasharath Masirkar <dmasirka>
Component: httpdAssignee: Web Stack Team <webstack-team>
Status: CLOSED ERRATA QA Contact: Martin Frodl <mfrodl>
Severity: unspecified Docs Contact:
Priority: high    
Version: 7.4CC: gaa, jhouska, jorton
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: httpd-2.4.6-43.el7 Doc Type: Bug Fix
Doc Text:
The HTTP status code 451 "Unavailable For Legal Reasons" was not usable in the httpd configuration. As a consequence, modules such as mod_rewrite could not be configured to return a 451 error if required for legal purposes. The 451 status code has been added to the list of available error codes, and modules can now be configured to return a 451 error if required.
Story Points: ---
Clone Of:
: 1353269 (view as bug list) Environment:
Last Closed: 2016-11-04 08:10:58 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1353269    

Description Dasharath Masirkar 2016-06-07 13:52:16 UTC
Description of problem:
The mod_rewrite (and possibly other modules) can't send a http 451 error code unless it is supported by the server, the current httpd version (httpd-2.4.6-40) in RHEL 7.2 doesn't support it. There is upstream bugzilla https://bz.apache.org/bugzilla/show_bug.cgi?id=58985 which has been resloved and patch is available which added this support.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Add following configuration to "/etc/httpd/conf/httpd.conf".
RewriteEngine On
RewriteRule ^ - [R=451,L]
2.Now start the httpd service
# systemctl start httpd
3. Now check httpd status.
# systemctl -l status  httpd

Actual results:

The httpd fails to start with below error message.
[root@rhle7]# systemctl -l status  httpd
httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled)
   Active: failed (Result: exit-code) since Tue 2016-06-07 18:50:12 IST; 9s ago
     Docs: man:httpd(8)
  Process: 26984 ExecStop=/bin/kill -WINCH ${MAINPID} (code=exited, status=1/FAILURE)
  Process: 26982 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
 Main PID: 26982 (code=exited, status=1/FAILURE)

Jun 07 18:50:12 localhost httpd[26982]: AH00526: Syntax error on line 355 of /etc/httpd/conf/httpd.conf:
Jun 07 18:50:12 localhost httpd[26982]: RewriteRule: invalid HTTP response code '451' for flag 'R'
Jun 07 18:50:12 localhost systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Jun 07 18:50:12 localhost kill[26984]: kill: cannot find process ""
Jun 07 18:50:12 localhost systemd[1]: httpd.service: control process exited, code=exited status=1
Jun 07 18:50:12 localhost systemd[1]: Failed to start The Apache HTTP Server.
Jun 07 18:50:12 localhost systemd[1]: Unit httpd.service entered failed state.

Expected results:

The httpd should start and allow mod_rewrite to send a http 451 error code.

Additional info:
Refer https://bz.apache.org/bugzilla/show_bug.cgi?id=58985

Comment 10 errata-xmlrpc 2016-11-04 08:10:58 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.