# Proxying requests based on $http\_authorization (API Key)

**URL:** <https://www.ruby-forum.com/t/proxying-requests-based-on-http-authorization-api-key/236264>\
**Category:** NGINX\
**Created:** [August 19, 2013, 9:56pm UTC](https://www.ruby-forum.com/t/proxying-requests-based-on-http-authorization-api-key/236264 "2013-08-19T21:56:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [August 19, 2013, 9:56pm UTC](https://www.ruby-forum.com/t/proxying-requests-based-on-http-authorization-api-key/236264/1 "2013-08-19T21:56:59Z")

</div>

Hello.

We are looking to proxy requests to different backends using upstream  
based  
on http basic auth. I.E. the API key of the request. I am thinking I  
need to  
first get the API key from the raw http request ($http\_authorization).  
Then  
do a lookup in redis for the backend to forward too.

We are already using OpenResty. Can we do this natively, or even better  
yet,  
are there 3rd party modules we can utilize to help with this? Is using  
lua  
required, or can we utilize standard nginx directives?

Thanks for the help, and insights.

Posted at Nginx Forum:

> **[Proxying requests based on $http\_authorization (API Key)](https://forum.nginx.org/read.php?2,242036,242036#msg-242036)**
>
> Hello. We are looking to proxy requests to different backends using upstream based on http basic auth. I.E. the API key of the request. I am thinking I need to first get the API key from the raw http request ($http\_authorization). Then do a lookup in...
