# How to forward basic-auth from upstream

**URL:** <https://www.ruby-forum.com/t/how-to-forward-basic-auth-from-upstream/244246>\
**Category:** NGINX\
**Created:** [March 10, 2016, 5:19pm UTC](https://www.ruby-forum.com/t/how-to-forward-basic-auth-from-upstream/244246 "2016-03-10T17:19:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [March 10, 2016, 5:19pm UTC](https://www.ruby-forum.com/t/how-to-forward-basic-auth-from-upstream/244246/1 "2016-03-10T17:19:45Z")

</div>

hi list,

i have an nginx infront of apaches, and the apacheshold a list of  
locations  
with basic-auth.

i cannot pass the auth-request from the upstream through nginx to  
the user, when i access the urls through nginx i get 403 Forbidden,  
while direct access sends the correct 401 Authorization Required  
back.

is there a simple way to passthrough the auth-request without  
doing nginx basic-auth itself?

what i’ve done so far (in any variation)

location /authme {  
…  
proxy\_pass\_header Authorization;  
more\_set\_headers -s 401 ‘WWW-Authenticate: Basic  
realm=“$host”’;  
more\_set\_input\_headers ‘Authorization: $http\_authorization’;  
…  
}

cheers,

mex

Posted at Nginx Forum:

> **[how to forward basic-auth from upstream](https://forum.nginx.org/read.php?2,265220,265220#msg-265220)**
>
> hi list, i have an nginx infront of apaches, and the apacheshold a list of locations with basic-auth. i cannot pass the auth-request from the upstream through nginx to the user, when i access the urls through nginx i get 403 Forbidden, whi
