How to process Facebook signed request to determine proxy target?

Ralf nginx-forum at nginx.us
Tue Feb 14 15:45:28 UTC 2012


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
(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?

2) 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.

3) 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: http://forum.nginx.org/read.php?2,222397,222397#msg-222397



More information about the nginx mailing list