B
B
bernex2015-09-04 09:43:18
JavaScript
bernex, 2015-09-04 09:43:18

How to ask Http Basic Auth depending on header?

There is a task to ask for a password and a name from users who logged in from ordinary browsers.
But do not ask if you have your own browser, with a special "Header".
Apache 2.4 configured.
Making a password for everyone is easy. How to make an exception?
Those. if the user agent contains the string "mybrowser": For example: User-Agent:Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) CMERP/0.7 Chrome/44.0 MyBrowser/0.31.2 Safari/537.36

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Roman, 2019-03-25
@gregst

Here is an example, everything works as it should (in my opinion). If in your opinion it does not work correctly, write in what way it does not meet your expectations.

B
bernex, 2015-09-04
@bernex

<If "%{HTTP_USER_AGENT} =~ /MyBrowser/">
  Require all granted
</If>

T
TyzhSysAdmin, 2015-09-04
@POS_troi

This is how gaping security holes appear.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question