1

Short version

Is it somehow possible to get the original request method out of the POST request that Facebook is performing to my web application?

Long version

I want to make my current web applications Facebook canvas frame compatible at the lowest level.

About Facebook Canvas

Apps on Facebook are web pages loaded into a Canvas frame .. When a user loads your Canvas app on Facebook, we load the Canvas URL within an iframe on that page. This results in your app being displayed within the standard Facebook chrome.

I'm a Ruby programmer and Rack Middleware seems to be a reasonable solution to this problem.

About Rack

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

About Rack Middleware

Between the server and the framework, Rack can be customized to your applications needs using middleware

Each middleware will be initialized with a object called env this object is some kind of Hash. It contains the key REQUEST_METHOD which represent a HTTP request method.

Facebook converts all request methods to POST. To get my application working in the Facebook Canvas context i would have to add a extra POST route to my application.

Instead i would like to rewrite the env['REQUEST_METHOD'] back to the original request method.

During research i found a gem called rack-facebook.

This gem is doing exactly what i want. It extracts ['fb_sig']['request_method'] from the params and assign it to env['REQUEST_METHOD'].

Sadly i also found a blog entry on the facebook dev blog

All Canvas apps must process signed_request (fb_sig will be removed)

May 10, 2011 at 8:25pm

About Facebook Signed Request

For certain types of apps, a signed request is passed to the app which contains some additional fields of information, even before Permissions have been requested.

I looked into the Facebook Developer Documentation and found out that request method or something similar is no longer part of the signed_request param.

Is it somehow possible to get the original request method out of the POST request that Facebook is performing to my web application?

Jan Owiesniak
  • 81
  • 2
  • 5

0 Answers0