P
P
pcdesign2015-12-09 17:22:58
Nginx
pcdesign, 2015-12-09 17:22:58

How to pass username from auth_basic nginx to backend?

Nginx uses the auth_basic module to authorize users.

location  ~^/area {
            auth_basic            "closed site";
            auth_basic_user_file  htpasswd;
            try_files $uri @backend;
    }

How to get the username that was used during authorization on the backend?
I need to do this for the flask framework, but I think the principle should be the same everywhere.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
L
Lynn "Coffee Man", 2015-12-09
@pcdesign

There is a $remote_user variable . Pass just like any other variable.

A
Andrew, 2015-12-09
@misterfil

If the backend is in PHP, then most likely so, let me know if it doesn’t work and indicate what your backend is on

<?php

echo '<pre>';
print_r($_SERVER);
echo '</pre>';
?>

E
Eugene, 2015-12-09
@Nc_Soft

If you need to check basic on the backend, then make this authorization the backend.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question