You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by MOKRANI Rachid <ra...@ifpen.fr> on 2018/06/13 12:27:26 UTC

[users@httpd] restrict Location URL with special string

Hi,

I have URL like below (with ? and =)

http://myserver/?s=about

What’s the correct syntax to allow only some IP.


<Location "/\?s\=about">
Require ip 127.0.0.1
</Location>


<Location "/?s=about">
Require ip 127.0.0.1
</Location>


<LocationMatch "about">
Require ip 127.0.0.1
</LocationMatch>


Nothing work.

Thanks in advance for any suggestion.
Regards.
__________________________
Avant d'imprimer, pensez à l'environnement ! Please consider the environment before printing ! 
Ce message et toutes ses pièces jointes sont confidentiels et établis à l'intention exclusive de ses destinataires. Toute utilisation non conforme à sa destination, toute diffusion ou toute publication, totale ou partielle, est interdite, sauf autorisation expresse. IFP Energies nouvelles décline toute responsabilité au titre de ce message. This message and any attachments are confidential and intended solely for the addressees. Any unauthorised use or dissemination is prohibited. IFP Energies nouvelles should not be liable for this message.
__________________________

Re: [users@httpd] restrict Location URL with special string

Posted by Eric Covener <co...@gmail.com>.
> Nothing work.

Those only match the path. In 2.2, use mod_rewrite. In 2.4, use <if>.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] restrict Location URL with special string

Posted by Rainer Canavan <ra...@sevenval.com>.
On Wed, Jun 13, 2018 at 2:27 PM MOKRANI Rachid <ra...@ifpen.fr> wrote:

> I have URL like below (with ? and =)
> http://myserver/?s=about
>
> What’s the correct syntax to allow only some IP.
> <Location "/\?s\=about">
> Require ip 127.0.0.1
> </Location>

<location> only matches the path part of the URL, not the query string
(i.e. the part after the ?).

There's an example for matching QUERY_STRING in
https://httpd.apache.org/docs/2.4/en/mod/core.html#if

<If "%{QUERY_STRING} =~ /s=about/">
Require ip 127.0.0.1
</if>

may work, but I haven't tested it.


rainer

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org