Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Rack middleware to fix Facebook always POST problem.
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE
README.rdoc Can now exclude requests by passing an :exclude => proc option.
Rakefile
VERSION
rack-facebook-method-fix.gemspec

README.rdoc

What?

In early 2011 Facebook started to send all iframe application requests as POST. Because of this most REST based applications broke. This Rack::Facebook::MethodFix middleware looks for incoming POST requests. If the request contains signed_request parameter it converts request to GET as originally intended. Optionally if you give Facebook application secret_id in middleware settings it will also validate the contents of signed_request parameter.

Install

gem install rack-facebook-method-fix

Usage

require "rack-facebook-method-fix"
use Rack::Facebook::MethodFix

or

require "rack-facebook-method-fix"
use Rack::Facebook::MethodFix, :secret_id => "c561df165eacdd6e32672c9eaee10318"

You can exclude requests from being processed by adding an exclude option:

use Rack::Facebook::MethodFix, :exclude => proc { |env| env['PATH_INFO'].match(/^\/admin/) }

This would make sure that no path in the /admin namespace would change from a POST to a GET regardless of the signed_request param.

Contributing to Rack::Facebook::MethodFix

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet

  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it

  • Fork the project

  • Start a feature/bugfix branch

  • Commit and push until you are happy with your contribution

  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright © 2011 Mika Tuupola. See LICENSE for further details.

Something went wrong with that request. Please try again.