Created
April 18, 2011 08:18
-
-
Save minikomi/924979 to your computer and use it in GitHub Desktop.
Redirection for unfound assets to dropbox for padrino
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error 404 do | |
link = "http://dl.dropbox.com/u/#{dropboxid}/#{public_folder}"+request.path_info | |
uri = URI.parse(link) | |
response = nil | |
Net::HTTP.start(uri.host, uri.port) { |http| | |
response = http.head(uri.path.size > 0 ? uri.path : "/")} | |
if response.code == "200" | |
redirect link | |
else | |
redirect '/' #any place you like, can be 404 page. | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment