logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Apache 2.4 | Accessing request header value
Author
RAJIV_KVL



Joined: 24 Apr 2018
Posts: 4

PostPosted: Mon 30 Apr '18 11:32    Post subject: Apache 2.4 | Accessing request header value Reply with quote

Hi ,

I want to grant access all to this below directory only if Request's Header contains this value. (GM_HTTPS_HEADER=ALLOWTOGMFTP)

If request header doesn't have this have in header, then user should not be able to access directory.

Can you please tell me how can i do that.

Alias /xreports "/usr/local/apache/htdocs/clients"
<DirectoryMatch "^/usr/local/apache/htdocs/clients/(?<CLIENTNAME>[^/]+)">
DirectoryIndex disabled
AllowOverride None
Options Indexes FollowSymLinks
AuthType Basic
Require all granted
IndexOptions FancyIndexing NameWidth=*
</DirectoryMatch>
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Mon 30 Apr '18 12:51    Post subject: Reply with quote

not tested, but it should work.
Code:

<LocationMatch ^/xreports>
    <If "%{HTTP:GM_HTTPS_HEADER} != 'ALLOWTOGMFTP'">
        Require all denied
    </If>
</LocationMatch>


For more info see
https://httpd.apache.org/docs/2.4/expr.html#functions
and
http://httpd.apache.org/docs/current/mod/mod_headers.html
Back to top
RAJIV_KVL



Joined: 24 Apr 2018
Posts: 4

PostPosted: Mon 30 Apr '18 13:36    Post subject: Reply with quote

mine is HTTPS..

It is not working for HTTPS
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7288
Location: Germany, Next to Hamburg

PostPosted: Mon 07 May '18 10:48    Post subject: Reply with quote

RAJIV_KVL wrote:
mine is HTTPS..

It is not working for HTTPS


Did you try? The HTTP in the regex is not limited to http:// only. see https://httpd.apache.org/docs/2.4/expr.html#functions
Back to top


Reply to topic   Topic: Apache 2.4 | Accessing request header value View previous topic :: View next topic
Post new topic   Forum Index -> Apache