httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Thuning <thun...@dsv.su.se>
Subject Re: [users@httpd] Allow relative paths in Directory directives?
Date Fri, 11 Sep 2020 11:29:56 GMT
Hi!

Thank you for your reply. There are absolutely more or less awful 
solutions that work around this issue, my preferred one being to abuse 
the <Location> directive, but I have the feeling that this is a fairly 
common thing that people want to do - block access to this subdirectory, 
exempt this directory from authentication, etc. Having the option of 
specifying such directories relative to the document root seems like a 
useful feature to me.

Shipping a largely functional example vhost file for a web application 
springs to mind as a good use case - simply instruct the user to modify 
the DocumentRoot and otherwise leave the file alone.

To be clear, I don't have an unresolved configuration problem that I 
want to solve. Rather I'm considering requesting a new feature that 
seems like it would be useful, and would like to know if there are any 
reasons that it would be a Bad Idea.

/T

On 2020-09-11 12:23, Gillis J. de Nijs wrote:
> Hi Erik,
>
> Couldn't you do something like this?
>
> <Directory "/www/*/public_html">
>
> That should work just fine, if you have your vhosts in a common 
> structure.  Alternatively, you could look at DirectoryMatch and come 
> up with something awful that matches your structure.
>
> https://httpd.apache.org/docs/2.4/mod/core.html#directory
> https://httpd.apache.org/docs/2.4/mod/core.html#directorymatch
>
> Cheers,
> Gillis
>
> On Fri, Sep 11, 2020 at 11:30 AM Erik Thuning <thuning@dsv.su.se 
> <mailto:thuning@dsv.su.se>> wrote:
>
>     Hi!
>
>     This is something that I keep thinking about when I configure my
>     various
>     vhosts, and would like feedback on, along with a pointer to where I
>     could request the change if it is actually sane.
>
>     Currently, <Directory> directives require an absolute path. I
>     would like
>     to be able to use paths relative to the DocumentRoot by omitting the
>     initial / in the path supplied in standard UNIX fashion (basically
>     treating the DocumentRoot as the working directory). If the
>     <Directory>
>     is specified in a context without a set DocumentRoot, it would be
>     considered an error.
>
>     To me this would solve a long-standing issue with feeling
>     compelled by
>     my own laziness to use <Location> directives when I want to customize
>     handling of directories inside the DocumentRoot. This is counter
>     to the
>     recommendations in the documentation but prepending the DocumentRoot
>     path everywhere is both cumbersome and error-prone, so I usually
>     go for
>     the "bad" approach.
>
>     Adding support for relative <Directory> directives could also make
>     certain configurations more portable by only needing to change the
>     DocumentRoot when cloning a vhost to a new directory, instead of
>     having
>     to update all instances of <Directory> as well.
>
>     I haven't been able to find any explicit rationale for the way the
>     directive works right now, so I don't know if I'm missing anything
>     fundamental that would make this unworkable. I would be thankful
>     for any
>     feedback pointing me to such a rationale if it exists.
>
>     Regards
>     Erik Thuning
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>     <mailto:users-unsubscribe@httpd.apache.org>
>     For additional commands, e-mail: users-help@httpd.apache.org
>     <mailto:users-help@httpd.apache.org>
>


Mime
View raw message