regex - NGINX: check whether $remote_user equals to the first part of the location -


I did not know how $ remote_user is equal to the first part location < / Code> of

  space / {auth_basic "elastic search"; Auth_basic_user_file / etc / nginx / search_passwords; Location ~ / ([^ /] *) / {# Named Capture if either ($ $ remote_user = $ 1) {# Error: unknown variable: $ 1 / $ NAMEDWHATEVER did not break; }}}  

My use-case:

I'm trying to secure an "ElasticSearch-Cluster" using a nginx-reverse proxy for authentication I am I want to allow multiple users, but the new user should make the modifications as simple as possible; Best Condition - Just Change the HTMLPDD File

I'm trying to adopt but it failed to check whether the remote_name and index-name Are similar.

This should be possible and you can also define a name of a variable when matching with regex Are there.

At the bottom of the code here, I assign the regex result to the $ username variable. So I can see it and if it matches $ remote_user (make sure it's set correctly, if I have debug it only), then I have a Added additional headings so that you can see it with the firebug network console or just using curl .

To see if it helps you.

  Location / {auth_basic "Elastic Search"; Auth_basic_user_file / etc / nginx / search_passwords; Place ~ / (? & Lt; Username & gt; ([^ /] *)) / {# Capture and store in username variable if ($ remote_user = $ username) {add_header 'matched' true $ username '; break; See also for more information. 


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -