You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Masanari Iida <st...@gmail.com> on 2020/04/14 04:48:40 UTC
[users@httpd] Header directive in Location
Hello
I would like to use "Header set " directive within Location directive.
But it doesn't work.
Example.
<Location /home/iida/apache-2.4.43/htdocs>
Header set Pragma no-cache
Header set Cache-Control no-cache
</Location>
But in Filematch or Directory directive, "Header set" works.
<FilesMatch "\.(html|htm)$">
Header set Pragma no-cache
Header set Cache-Control no-cache
</FilesMatch>
As I read online manual,
https://httpd.apache.org/docs/current/en/mod/mod_headers.html
> Header
> Context:server config, virtual host, _directory_, .htaccess
> directory A directive marked as being valid in this context may be
> used inside <Directory>, <Location>, <Files>, <If>, and <Proxy>
> containers in the server configuration files, subject to the
> restrictions outlined in Configuration Sections.
This document tells that I can use Header directive in "Location".
FYI, I have tested this on apache-2.4.43.
Masanari Iida
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Header directive in Location
Posted by Masanari Iida <st...@gmail.com>.
Now I understand what is my problem.
I should have specified something like following example.
DocumentRoot /home/iida/apache-2.4.43/htdocs
<Location /dir_name>
Header set Pragma no-cache
Header set Cache-Control no-cache
</Location>
Now apache added headers if I access to html under /dir_name.
Thanks for the comment.
Masanari Iida
On Tue, Apr 14, 2020 at 8:05 PM Eric Covener <co...@gmail.com> wrote:
>
> On Tue, Apr 14, 2020 at 12:49 AM Masanari Iida <st...@gmail.com> wrote:
> >
> > Hello
> >
> > I would like to use "Header set " directive within Location directive.
> > But it doesn't work.
> > Example.
> > <Location /home/iida/apache-2.4.43/htdocs>
>
> ^^ Looks a lot like a Directory argument.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Header directive in Location
Posted by Eric Covener <co...@gmail.com>.
On Tue, Apr 14, 2020 at 12:49 AM Masanari Iida <st...@gmail.com> wrote:
>
> Hello
>
> I would like to use "Header set " directive within Location directive.
> But it doesn't work.
> Example.
> <Location /home/iida/apache-2.4.43/htdocs>
^^ Looks a lot like a Directory argument.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org