RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1896576 - Regression: SetHandler doesn't seem to work per <Directory> directive anymore
Summary: Regression: SetHandler doesn't seem to work per <Directory> directive anymore
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: httpd
Version: 8.3
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: rc
: 8.0
Assignee: Luboš Uhliarik
QA Contact: rhel-cs-infra-services-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-11-10 23:23 UTC by Robert Scheck
Modified: 2022-02-01 13:56 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-02-01 13:56:35 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Robert Scheck 2020-11-10 23:23:16 UTC
Description of problem:
It seems like the SetHandler doesn't seem to work per <Directory> directive in the httpd of RHEL 8 anymore, while this worked as expected in the httpd of RHEL 7.

The Apache web server documentation however does not give the impression that this would not work anymore:

 - https://httpd.apache.org/docs/2.4/en/mod/core.html#directory
 - https://httpd.apache.org/docs/2.4/en/mod/core.html#filesmatch
 - https://httpd.apache.org/docs/2.4/en/mod/core.html#sethandler
 - https://httpd.apache.org/docs/2.4/en/sections.html

For this reason, I am assuming this is a regression, and thus a bug.

Version-Release number of selected component (if applicable):
httpd-2.4.37-30.module+el8.3.0+7001+0766b9e7.x86_64

How reproducible:
Always, see below.

Steps to Reproduce:
0. RHEL 8 minimal installation, subscribed to Red Hat Customer Portal
1. dnf update -y
2. dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm https://rpms.remirepo.net/enterprise/remi-release-8.rpm -y
3. dnf install httpd php72-php-fpm php73-php-fpm php74-php-fpm php80-php-fpm -y
4. mkdir -p /var/www/html/php{72,73,74,80}
5. echo '<?php echo phpversion() . PHP_EOL; ?>' > /var/www/html/index.php
6. for v in /var/www/html/*; do echo '<?php echo phpversion() . PHP_EOL; ?>' > $v/index.php; done
7. sed -e 's/^/#/' -i /etc/httpd/conf.d/*.conf
8. cat > /etc/httpd/conf.d/test.conf <<EOF
AddType text/html .php
DirectoryIndex index.php
<Proxy fcgi://localhost>
    ProxySet connectiontimeout=5 timeout=240
</Proxy>
<Directory "/var/www/html">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php74/run/php-fpm/www.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>
<Directory "/var/www/html/php72">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php72/run/php-fpm/www.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>
<Directory "/var/www/html/php73">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php73/run/php-fpm/www.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>
<Directory "/var/www/html/php74">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php74/run/php-fpm/www.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>
   <Directory "/var/www/html/php80">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php80/run/php-fpm/www.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>
EOF
9. systemctl enable httpd php72-php-fpm php73-php-fpm php74-php-fpm php80-php-fpm --now
10. for i in $(seq 1 10); do echo "Sequence #$i"; for v in "" php72 php73 php74 php80; do echo -n "${v:-php74}: "; curl http://localhost/$v/; done; done

Actual results:
[root@rhel8-web ~]# for i in $(seq 1 10); do echo "Sequence #$i"; for v in "" php72 php73 php74 php80; do echo -n "${v:-php74}: "; curl http://localhost/$v/; done; done
Sequence #1
php74: 7.4.12
php72: 7.4.12
php73: 7.4.12
php74: 7.4.12
php80: 7.4.12
Sequence #2
php74: 7.4.12
php72: 7.4.12
php73: 7.4.12
php74: 7.4.12
php80: 7.3.24
Sequence #3
php74: 7.3.24
php72: 7.4.12
php73: 7.4.12
php74: 7.3.24
php80: 7.4.12
Sequence #4
php74: 7.3.24
php72: 7.4.12
php73: 7.3.24
php74: 7.3.24
php80: 7.3.24
Sequence #5
php74: 7.3.24
php72: 7.3.24
php73: 7.3.24
php74: 7.3.24
php80: 7.3.24
Sequence #6
php74: 7.4.12
php72: 7.3.24
php73: 7.3.24
php74: 7.3.24
php80: 7.3.24
Sequence #7
php74: 7.3.24
php72: 7.4.12
php73: 7.4.12
php74: 7.3.24
php80: 7.4.12
Sequence #8
php74: 7.4.12
php72: 7.4.12
php73: 7.4.12
php74: 7.3.24
php80: 7.3.24
Sequence #9
php74: 7.3.24
php72: 7.3.24
php73: 7.3.24
php74: 7.3.24
php80: 7.4.12
Sequence #10
php74: 7.4.12
php72: 7.4.12
php73: 7.3.24
php74: 7.3.24
php80: 7.3.24
[root@rhel8-web ~]# 

Yes...barely the expected PHP version. If you re-run the loop, there will be indeed other unexpected results for the next sequences.

Conclusion: It feels a bit like Apache web server does no longer treat the SetHandler per <Directory> directive?!

Expected results:
All the time, no matter how often you re-run the loop:
php74: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0~rc4

Comment 1 Robert Scheck 2020-11-10 23:29:01 UTC
Cross-filed case 02799476 at the Red Hat customer portal.

Comment 2 Remi Collet 2020-11-12 11:13:06 UTC
If such configuration you have 4 proxy, so cannot use a single name and Proxy directive for all

Working configuration

DirectoryIndex index.php
<Proxy fcgi://localhost>
    ProxySet connectiontimeout=5 timeout=240
</Proxy>
<Proxy fcgi://localhost72>
    ProxySet connectiontimeout=5 timeout=240
</Proxy>
<Proxy fcgi://localhost73>
    ProxySet connectiontimeout=5 timeout=240
</Proxy>
<Proxy fcgi://localhost80>
    ProxySet connectiontimeout=5 timeout=240
</Proxy>
<Directory "/var/www/html">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php74/run/php-fpm/www.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>
<Directory "/var/www/html/php72">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php72/run/php-fpm/www.sock|fcgi://localhost72/"
    </FilesMatch>
</Directory>
<Directory "/var/www/html/php73">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php73/run/php-fpm/www.sock|fcgi://localhost73/"
    </FilesMatch>
</Directory>
<Directory "/var/www/html/php74">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php74/run/php-fpm/www.sock|fcgi://localhost/"
    </FilesMatch>
</Directory>
   <Directory "/var/www/html/php80">
    <FilesMatch \.(phar|php)$>
        SetHandler "proxy:unix:/var/opt/remi/php80/run/php-fpm/www.sock|fcgi://localhost80/"
    </FilesMatch>
</Directory>



With above;
# for i in $(seq 1 10); do echo "Sequence #$i"; for v in "" php72 php73 php74 php80; do echo -n "${v:-phpxx}: "; curl http://localhost/$v/; done; done
Sequence #1
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #2
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #3
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #4
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #5
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #6
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #7
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #8
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #9
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4
Sequence #10
phpxx: 7.4.12
php72: 7.2.34
php73: 7.3.24
php74: 7.4.12
php80: 8.0.0RC4

Comment 3 Robert Scheck 2020-11-12 12:07:34 UTC
Remi, thank you very much for digging into this! Has this behaviour changed between httpd-2.4.6-95.el7.x86_64 and httpd-2.4.37-30.module+el8.3.0+7001+0766b9e7.x86_64? Or did it work in httpd-2.4.6-95.el7.x86_64 just by accident? I did not see any documented changes in the upstream httpd changelog...

Comment 7 Remi Collet 2021-12-08 13:15:51 UTC
@pandurang more a question for Lubos (httpd) than for me (php)

Comment 9 Robert Scheck 2022-01-31 14:30:50 UTC
Red Hat GSS/CEE has let us know:

> Behavior has changed in upstream[1] product.You need to add disable=reuse in configuration. 
> 
> [1] https://github.com/apache/httpd/commit/bf91e089a09ddeaab17cf9e97558f2aa29cf7eca 

For us this answers comment #3 - thank you, so this RHBZ can be closed (can somebody from Red Hat please perform this final step? I'm not having enough permissions as it seems).

Comment 10 Luboš Uhliarik 2022-02-01 13:56:35 UTC
This behavior has changed in upstream.

Commit: https://github.com/apache/httpd/commit/bf91e089a09ddeaab17cf9e97558f2aa29cf7eca




If you add "disablereuse=on" to wanted ProxySet directive, httpd will behave as before.

# diff /etc/httpd/conf.d/test.conf.new /etc/httpd/conf.d/test.conf.old
4c4
<     ProxySet connectiontimeout=5 timeout=240
---
>     ProxySet connectiontimeout=5 timeout=240 disablereuse=on




Output after performed changes:

# for i in $(seq 1 10); do echo "Sequence #$i"; for v in "" php72 php73 php74 php80; do echo -n "${v:-php74}: "; curl http://localhost/$v/; done; done
Sequence #1
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #2
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #3
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #4
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #5
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #6
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #7
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #8
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #9
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1
Sequence #10
php74: 7.4.27
php72: 7.2.34
php73: 7.3.33
php74: 7.4.27
php80: 8.0.15RC1


Hope it helps.


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