[Bug 64740] New: CONTEXT_PREFIX not available with AliasMatch

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 64740] New: CONTEXT_PREFIX not available with AliasMatch

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64740

            Bug ID: 64740
           Summary: CONTEXT_PREFIX not available with AliasMatch
           Product: Apache httpd-2
           Version: 2.4.39
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: mod_alias
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

When I define an alias with this code :
> Alias /pma2 /data/www/phpMyAdmin2/current
> <Directory "/data/www/phpMyAdmin2/current">

I'm able to get the CONTEXT_PREFIX (from phpinfo() ) :
> _SERVER["CONTEXT_PREFIX"] /pma2

However, as described in the AliasMatch documentation
(https://httpd.apache.org/docs/2.4/fr/mod/mod_alias.html#aliasmatch), if I
simply replace the previous configuration by :
> AliasMatch "^/pma2/(.*)$" "/data/www/phpMyAdmin2/current/$1"
> <Directory "/data/www/phpMyAdmin2/current">

The CONTEXT_PREFIX is not defined :
> _SERVER["CONTEXT_PREFIX"] no value

Also, the documentation about the Apache variables
(https://httpd.apache.org/docs/2.4/fr/expr.html#vars) provides no description
about CONTEXT_PREFIX and CONTEXT_DOCUMENT_ROOT.

So, is this behaviour normal ? I really need to use AliasMatch (Alias doesn't
meet my needs). How can I retrieve the CONTEXT_PREFIX with the use of
AliasMatch ?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64740] CONTEXT_PREFIX not available with AliasMatch

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64740

Eric Covener <[hidden email]> changed:

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

--- Comment #1 from Eric Covener <[hidden email]> ---
Hello, my recollection was that the implementation for AliasMatch simply didn't
work.  After more consideration, it is hard to consider what meaning the
context prefix could have for any non-trivial regex -- the whole point of
aliasmatch over alias is when the mapping cannot be expressed as a "prefix".

Perhaps you could set CONTEXT_PREFIX via a capture and backreference? The
timing of the multiple directives neeeded would be tricky.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64740] CONTEXT_PREFIX not available with AliasMatch

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64740

Jordan LE NUFF <[hidden email]> changed:

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

--- Comment #2 from Jordan LE NUFF <[hidden email]> ---
(In reply to Eric Covener from comment #1)
Thank you for the details Eric.

I did some tests in order to set CONTEXT_PREFIX by myself, but it seems Apache
doesn't let me do it.

Here's what I did :
> AliasMatch "^/pma2/(.*)$" "/data/www/phpMyAdmin2/current/$1"
> <Directory "/data/www/phpMyAdmin2/current">
> SetEnvIf Request_URI "^(/[[:alnum:]_-]+)(/.*)?" CONTEXT_PREFIX_test=$1
> SetEnvIf Request_URI "^(/[[:alnum:]_-]+)(/.*)?" CONTEXT_PREFIX=$1

And here is what I obtain :
> _SERVER["CONTEXT_PREFIX_test"] /pma2
> _SERVER["CONTEXT_PREFIX"] no value

Is that what you meant by capture and backreference ?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64740] CONTEXT_PREFIX not available with AliasMatch

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64740

--- Comment #3 from Eric Covener <[hidden email]> ---
(In reply to Jordan LE NUFF from comment #2)

> (In reply to Eric Covener from comment #1)
> Thank you for the details Eric.
>
> I did some tests in order to set CONTEXT_PREFIX by myself, but it seems
> Apache doesn't let me do it.
>
> Here's what I did :
> > AliasMatch "^/pma2/(.*)$" "/data/www/phpMyAdmin2/current/$1"
> > <Directory "/data/www/phpMyAdmin2/current">
> > SetEnvIf Request_URI "^(/[[:alnum:]_-]+)(/.*)?" CONTEXT_PREFIX_test=$1
> > SetEnvIf Request_URI "^(/[[:alnum:]_-]+)(/.*)?" CONTEXT_PREFIX=$1
>
> And here is what I obtain :
> > _SERVER["CONTEXT_PREFIX_test"] /pma2
> > _SERVER["CONTEXT_PREFIX"] no value
>
> Is that what you meant by capture and backreference ?

Sorry, from your result it does look like it's blown away.

I am curious if that's your actual AliasMatch and why Alias doesn't work for
you?  Or is the example simplified?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 64740] CONTEXT_PREFIX not available with AliasMatch

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=64740

--- Comment #4 from Jordan LE NUFF <[hidden email]> ---
(In reply to Eric Covener from comment #3)

> I am curious if that's your actual AliasMatch and why Alias doesn't work for
> you?  Or is the example simplified?

Yes, my example is simplified.

My directory tree is like this :
├── home
│   ├── www
│   │   ├── env1
│   │   │   ├── STAGING
│   │   │   │   ├── App1
│   │   │   │   ├── App2
│   │   │   │   ├── App3
│   │   ├── env2
│   │   │   ├── STAGING
│   │   │   │   ├── App1
│   │   │   │   ├── App2
│   │   │   │   ├── App3
│   │   ├── env3
│   │   │   ├── STAGING
│   │   │   │   ├── App1
│   │   │   │   ├── App2
│   │   │   │   ├── App3

I want to access to all App1 from STAGING by a URL like
http://stage-app1.mydomain.com/.

Also, for accessing to App1 from STAGING from env2, I will use
http://stage-app1.mydomain.com/env2/.

My Apache configuration works great with AliasMatch :
> AliasMatch "^/([[:alnum:]_-]+)(/.*)?" "/home/www/$1/STAGING/App1/$2"
> <Directory "/home/www/*/STAGING/App1">

But I really need a dynamic CONTEXT_PREFIX.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]