0

That's it. I need to redirect just the POST requests. Something like:

rewrite /.*/, '/universal_POST_handler', :if => (something_cool_goes_here)

Is it possible?

Erik Escobedo
  • 2,793
  • 24
  • 42

2 Answers2

1

The purpose of a rewriter in an application that has routing is to rewrite legacy URLs to more current URLs. Legacy URLs are URLs that were supported and that external users have come to depend on but that are no longer supported because the architecture of the application has changed.

You should use the router instead.

post '*path' => 'actions#universal',
  :constraints => FancyConstraint.new
yfeldblum
  • 65,165
  • 12
  • 129
  • 169
0

From the README:

Using the :method option you can restrict the matching of a rule by the HTTP method of a given request.

redirect GETs one way

r301 "/players", "/current_players", :method => :get

and redirect POSTs another way

r302 "/players", "/no_longer_available.html?message=No&longer&supported", :method => :post

Arnaud Meuret
  • 985
  • 8
  • 26