Forum Moderators: phranque

Message Too Old, No Replies

apache proxy rule

         

JustLeo

1:58 pm on May 3, 2012 (gmt 0)

10+ Year Member



Hello, I have an apache configured as a proxy and I have the follwing question? Is it possible to restrict access to an specific page and allow the access to the rest of them.
e.g:

[mydomain.com...] -> Only one user should access it
[mydomain.com...] -> Everyone can access it

Any help will be much appreciated. Thanks in advance.

phranque

8:40 am on May 4, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, JustLeo!

depending on how you recognize the "one user" (IP address?) you can probably work something up using a combination of RewriteCond and RewriteRule directives along with use of the [P] flag:
http://httpd.apache.org/docs/current/rewrite/flags.html#flag_p

then you can use the [F] flag to forbid those who shouldn't get access to the restricted content.

JustLeo

2:52 pm on May 4, 2012 (gmt 0)

10+ Year Member



Thanks for the welcome Phranque. I need to recognize the "one user" by his/her username.
I'm not an expert on this matter, so if you could give me some more clues, I'll appreciate it very much.
Do you know how can I recognize the user and apply the [F] flag, in case the user is not suppose to access the page?

g1smd

3:03 pm on May 4, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



How will the user present their username?

Will it be typed in on a form on the immediately preceding screen, or will it be previously stored in a cookie? Some other method?

JustLeo

3:21 pm on May 4, 2012 (gmt 0)

10+ Year Member



Users are prompt for an user and password. The proxy is using LDAP in order to authenticate the users.

JustLeo

8:01 pm on May 4, 2012 (gmt 0)

10+ Year Member



I would like to capture the username that is trying to access to a specific URL, compare that name with another varible/group and depending on the result, allow access or denied.
Let me know if more information is needed.

lucy24

2:32 am on May 5, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Can you tweak your site design so all the password-protected material is in a directory by itself? This is a whole lot easier than coding for one specific page.

phranque

4:06 am on May 5, 2012 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you can check REMOTE_USER in a mod_rewrite RewriteCond directive if using http basic or digest authentication.

JustLeo

3:09 pm on May 6, 2012 (gmt 0)

10+ Year Member



May I ask someone to show me how would be the rule using REMOTE_USER in order to allow access or not to an specific user? I believe this is the correct way.
I tried using <proxymatch> but I wasn't able to get it working.