Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pismo Redirection Not Allowed #15

Open
sidbatra opened this issue Apr 5, 2012 · 5 comments
Open

Pismo Redirection Not Allowed #15

sidbatra opened this issue Apr 5, 2012 · 5 comments

Comments

@sidbatra
Copy link

sidbatra commented Apr 5, 2012

Any fix planned for allowing redirects? thanks!

"redirection forbidden: http://www.bettiepageclothing.com -> https://www.bettiepageclothing.com/"

@Jeewes
Copy link

Jeewes commented Aug 20, 2012

I would also appriciate allowing redirects. This guestion on stackoverflow seems to deal the same problem. Suppose open-uri is the cause of the problem.

@andyatkinson
Copy link

@peterc I think this has been a problem forever in open-uri. Do you have a recommendation for what to do here? I tried adding this gem that monkey patches open-uri and provides a allow_redirects option. I tried this out with a New York Times article and it followed their redirect, but hit their paywall, which means the NYT link isn't useful in our app, but it still feels like there should be a built-in way to allow redirects, at least "safe" ones. https://github.com/andyatkinson/pismo/commit/39da3f68380e8260a787562e4f3e21c752a2791d

@peterc
Copy link
Owner

peterc commented Mar 11, 2014

Hmm, well they must be detecting it somehow, so I'm guessing it's probably through the User-Agent on the request? If so, spoofing that User-Agent with that from a regular browser could work.

Pismo essentially includes open-uri to act as a sort of fallback if you didn't obtain the data in any other way or with a better/proper library, so I don't think going too far in implementing a more powerful HTTP client is a good idea, when they already exist separately (such as Typhoeus or even net/http). That said, spoofing the User-Agent is most likely the quick/cheap fix.

@andyatkinson
Copy link

Ok. I'll mess around with the user-agent and try out a separate HTTP library. Thanks for the ideas!

@peterc
Copy link
Owner

peterc commented Mar 11, 2014

If you find one that's pretty customizable and pure Ruby, let me know as it could become a dependency here. Any native/compiled stuff would be a no-no. Though to be fair, net/http could be used in a more advanced way here I guess..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants