You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2020/11/09 14:17:00 UTC

[Bug 64910] New: Header not set if under Location/LocationMatch and not a physical path

https://bz.apache.org/bugzilla/show_bug.cgi?id=64910

            Bug ID: 64910
           Summary: Header not set if under Location/LocationMatch and not
                    a physical path
           Product: Apache httpd-2
           Version: 2.4.46
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: mod_headers
          Assignee: bugs@httpd.apache.org
          Reporter: manus@manusfreedom.com
  Target Milestone: ---

```
<VirtualHost *:443>
...
# Does not work
<Location "/mytest">
  Header always set AAA-Test "helloMyTest"
</Location>
# Works (tmp/index.html path exist)
<Location "/tmp">
  Header always set AAA-Test "helloTmp"
</Location>
# Does not work
<LocationMatch "/mytest"> # or "mytest" or "/mytest/.*"
  Header always set AAA-Test "helloMyTest"
</Location>
# Works (tmp/index.html path exist) but "/tmp/notexist" does not work
<LocationMatch "/tmp"> # or "tmp" or "/tmp/.*"
  Header always set AAA-Test "helloTmp"
</LocationMatch>
# Works always
<LocationMatch "/.*">
  Header always set AAA-Test "helloTmp"
</LocationMatch>
...
</VirtualHost>
```

Tested on Ubuntu 18.04 using http://ppa.launchpad.net/ondrej/apache2/ubuntu

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 64910] Header not set if under Location/LocationMatch and RewriteRule

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64910

Romain Lapoux <ma...@manusfreedom.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Header not set if under     |Header not set if under
                   |Location/LocationMatch and  |Location/LocationMatch and
                   |not a physical path         |RewriteRule

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 64910] Header not set if under Location/LocationMatch and not a physical path

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64910

--- Comment #3 from Romain Lapoux <ma...@manusfreedom.com> ---
Sorry, I found the problem after a full Apache Dump and analyze/test of it.
It's a problem with a RewriteRule.
Consider the following config:
############ vHost content
<VirtualHost *:443>
  SuexecUserGroup "#1041" "#1030"
  ServerName mydomain.com
  ServerAlias www.mydomain.com
  ErrorLog /var/log/virtualmin/mydomain.com_error_log
  CustomLog /var/log/virtualmin/mydomain.com_access_log combined
  DocumentRoot "/home/mydomain.com/public_html"
  ScriptAlias "/cgi-bin/" "/home/mydomain.com/cgi-bin/"
  DirectoryIndex index.php index.html index.htm index.php4 index.php5
  SetEnvIf X-Forwarded-Proto https HTTPS=on
  <Directory "/home/mydomain.com/public_html/.well-known">
    AuthType None
    allow from all
    Require all granted
    Satisfy any
  </Directory>
  <LocationMatch "mytest">
    Header always set AAA-Test "helloMyTest"
  </LocationMatch>
  <LocationMatch "/tmp/.*">
    Header always set AAA-Test "helloTmp"
  </LocationMatch>
  <LocationMatch "/tmp5/.*">
    Header always set AAA-Test "helloTmp5"
  </LocationMatch>
  <Directory /home/mydomain.com/public_html>
    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
    allow from all
    Require all granted
    RewriteRule .* /home/mydomain.com/public_html/index.php [L]
  </Directory>
  RewriteEngine on
  SSLEngine on
  SSLCertificateFile /home/mydomain.com/ssl.cert
  SSLCertificateKeyFile /home/mydomain.com/ssl.key
  SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
  ScriptAlias /awstats/ /home/mydomain.com/cgi-bin/
  <Files awstats.pl>
    AuthName "mydomain.com statistics"
    AuthType Basic
    AuthUserFile /home/mydomain.com/.awstats-htpasswd
    Require valid-user
  </Files>
  SSLCACertificateFile /home/mydomain.com/ssl.ca
</VirtualHost>
############
/home/mydomain.com/public_html/ is empty.

With this config, headers are never set, but if we move `RewriteRule .*
/home/mydomain.com/public_html/index.php [L]` outside the
`<Directory></Directory>` directive, header are correclty set.

So we are unable to use Location* and Header if this RewriteRule is set in a
Directory directive.
And to finish no problem if we set this directive in .htaccess of the same
directory:
############ .htaccess content
RewriteEngine on
RewriteRule .* /home/rlx-tech.fr/public_html/index.php [L]
############

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 64910] Header not set if under Location/LocationMatch and RewriteRule in Directory

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64910

Romain Lapoux <ma...@manusfreedom.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Header not set if under     |Header not set if under
                   |Location/LocationMatch and  |Location/LocationMatch and
                   |RewriteRule                 |RewriteRule in Directory

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 64910] Header not set if under Location/LocationMatch and not a physical path

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64910

--- Comment #1 from Romain Lapoux <ma...@manusfreedom.com> ---
It's seem an old bug but not fixed:
https://serverfault.com/questions/838623/apache-location-baz-directive-not-matching
https://serverfault.com/questions/995849/locationmatch-in-the-virtual-host-not-working

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 64910] Header not set if under Location/LocationMatch and not a physical path

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=64910

Eric Covener <co...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO

--- Comment #2 from Eric Covener <co...@gmail.com> ---
Can you elaborate on what you mean by "not a physical path"?


# Does not work
<Location "/mytest">
  Header always set AAA-Test "helloMyTest"
</Location>

It works for me if I request /mytest and get a 404.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org