Comments (3)
Hi @doutatsu, I believe the confusion here is that FollowRedirects
only follows "hard" redirects. That's when the server returns one of the 3xx status codes together with a Location
header indicating the redirect location (see https://github.com/lostisland/faraday_middleware/blob/main/lib/faraday_middleware/response/follow_redirects.rb#L7).
To my knowledge, those pages you're referring to work differently. The response in that case is a 200 status containing an HTML body (hence why you can see the page on the browser), which normally redirect you to the right page after a few seconds. This uses either a meta
tag or a JS snippet to accomplish the redirect.
I'm afraid in such case you'd need to parse the response body (HTML/JS) and look for the redirection url, and this is something outside of the scope of the FollowRedirects
middleware.
There might be another middleware accomplishing what you need (though I've never encountered it), or you might write your own middleware and reuse some existing gem that does the heavy lifting in the implementation.
Please let me know if the above helps and if you have any further question!
from faraday_middleware.
Thanks for a detailed response @iMacTia - I was suspecting this, but wanted to double-check. I'll need to see if there is anything in the response with the URL, but I suspect they redirect using JS, which won't work with the plain HTTP request
from faraday_middleware.
Glad that was at least helpful and sorry for not being able to provide an actual solution. I'll close the issue for now but please, should you find a way forward, could you kindly share it here as well? I'm sure other people in future may find it useful 💪.
I'm obviously available to answer any further question as well, especially if you decide to go down the road of writing a middleware 🙌!
from faraday_middleware.
Related Issues (20)
- RSpec refactoring: JRuby tests skipped using metadata HOT 1
- Deprecation warning re Faraday::Error::ClientError HOT 5
- Autoloads incomplete for FaradayMiddleware::RedirectLimitReached HOT 2
- Add support for Faraday 1.0 HOT 2
- Ship v1.0 HOT 8
- RuboCop Quest Issue HOT 4
- ruby 2.7.0 warnings HOT 2
- Reconsider SafeYAML gem dependency HOT 4
- Turn wiki into docs/ of Markdown HOT 2
- Configure RuboCop cops HOT 1
- Configure Codeclimate RuboCop support
- Gzip middleware seems mandatory when used with json response middleware? HOT 4
- Gemify Rashify middleware HOT 1
- FollowRedirects should disregard content headers HOT 1
- Linting
- CI: Improve GH Actions matrix
- Deprecate `FaradayMiddleware::Instrumentation` in favor of `Faraday::Request::Instrumentation`? HOT 2
- faraday 2 support HOT 5
- undefined method `dependency' for ActiveCampaign::Faraday::Middleware::Request:Class (NoMethodError) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faraday_middleware.