I want to make a simple Sinatra app that when I navigate to “/proxy/:someurl” I will see the exact contents of navigating directly to :someurl, AKA a simple web proxy, sort of like a full-page iframe.
What is the best way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This script gets a page’s content, thanks to OpenURI, fixes scripts, stylesheets and images links, then displays the result.
I used a
/proxy?url=http://url.com/route instead of a/proxy/urlone. Sinatra doesn’t like the slashes and special chars that are usually in URLs.