# How to process Facebook signed request to determine proxy target?

**URL:** <https://www.ruby-forum.com/t/how-to-process-facebook-signed-request-to-determine-proxy-target/216810>\
**Category:** NGINX\
**Created:** [February 14, 2012, 4:45pm UTC](https://www.ruby-forum.com/t/how-to-process-facebook-signed-request-to-determine-proxy-target/216810 "2012-02-14T16:45:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [February 14, 2012, 4:45pm UTC](https://www.ruby-forum.com/t/how-to-process-facebook-signed-request-to-determine-proxy-target/216810/1 "2012-02-14T16:45:55Z")

</div>

Hello all,

we’re using a Nginx as proxy gateway to several customer specific apache  
instances on different servers.

In order to determine where to route the traffic from a Facebook  
application, we need to extract the page id from the Facebook signed  
request  
([Manually Build a Login Flow - Facebook Login - Documentation - Meta for Developers](http://developers.facebook.com/docs/authentication/signed_request/)) and  
look up its respective target apache instance in a table (probably from  
memcached).

As I don’t have much experience with Nginx yet, I’d like to ask for your  
feedback on some theoretical solutions I’ve come up with:

1. Extract the signed request from the POST data with the  
HttpFormInputModule or HttpLuaModule and use HttpMemcModule for  
interactions with memcached.

From my understanding, this whole operation could be defined in the  
nginx.conf or site.conf file then, which is favorable, but I haven’t  
found out yet if I’d be actually be able to decode the signed request  
for processing. Is there maybe another third party module available for  
this?

1. Use the EmbeddedPerlModule, which is still in experimental stage as I  
understand, and write a perl script similar to the php script posted on  
the Facebook link above to retrieve the required page id value. Then  
access memcached from within the script or with the HttpMemcModule.

2. Write my own Nginx module.

What would you suggest is the best way to go about this or do you maybe  
have better solutions?

Thanks,  
Ralf

Posted at Nginx Forum:

> **[How to process Facebook signed request to determine proxy target?](https://forum.nginx.org/read.php?2,222397,222397#msg-222397)**
>
> Hello all, we're using a Nginx as proxy gateway to several customer specific apache instances on different servers. In order to determine where to route the traffic from a Facebook application, we need to extract the page id from the Facebook signed...

---

<div class="post-metadata">

**Author:** ![ralf](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/c89c15/32.png) [@ralf](https://www.ruby-forum.com/u/ralf)\
**Post date:** [September 10, 2013, 6:00pm UTC](https://www.ruby-forum.com/t/how-to-process-facebook-signed-request-to-determine-proxy-target/216810/2 "2013-09-10T18:00:18Z")

</div>

Hi Ralf,

I’m currently working on a similar functionality. Have you managed to  
find a  
solution?

Thanks,  
Mircea

Posted at Nginx Forum:

> **[Re: How to process Facebook signed request to determine proxy target?](https://forum.nginx.org/read.php?2,222397,242728#msg-242728)**
>
> Hello all, we're using a Nginx as proxy gateway to several customer specific apache instances on different servers. In order to determine where to route the traffic from a Facebook application, we need to extract the page id from the Facebook signed...
