Bug 1343582 - Support sending http 451 status code from RewriteRule
Summary: Support sending http 451 status code from RewriteRule
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: httpd
Version: 7.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: ---
Assignee: Luboš Uhliarik
QA Contact: Martin Frodl
Depends On:
Blocks: 1353269
TreeView+ depends on / blocked
Reported: 2016-06-07 13:52 UTC by Dasharath Masirkar
Modified: 2021-01-14 09:34 UTC (History)
3 users (show)

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.
Clone Of:
: 1353269 (view as bug list)
Last Closed: 2016-11-04 08:10:58 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Apache Bugzilla 58985 0 None None None 2016-06-07 14:08:18 UTC
Red Hat Product Errata RHEA-2016:2534 0 normal SHIPPED_LIVE httpd bug fix and enhancement update 2016-11-03 14:17:49 UTC

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.


Note You need to log in before you can comment on or make changes to this bug.