Issue 403 when connecting to page with redirects #646
Unanswered
MarcoPrins
asked this question in
Q&A
Replies: 1 comment 9 replies
-
@MarcoPrins Interesting. I'm not sure I'm going to be able to fully debug this, but let me equip you with some debugging tools so you can explore on your own if you like. When I visit this URL using
In the output I see the following responses:
When I run with Mechanize using the "Windows Chrome" user agent alias: #! /usr/bin/env ruby
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "mechanize", path: "."
end
url = "https://right-to-work.service.gov.uk/rtw-view"
agent = Mechanize.new
agent.user_agent_alias = "Windows Chrome"
agent.log = Logger.new(STDOUT)
page = agent.get(url) I get:
This looks like the same sequence of requests and responses, so I'm not sure why the server is responding with a 403. If there's a bug in Mechanize here I would love your help trying to isolate it! |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm getting a 403 forbidden with mechanize when visiting this page, however the same page displays fine when using
RestClient
What is the issue here? Seems like mechanize is not handling redirects properly?
To replicate, please try the same url as I used below; It's a public url
Version 2.10.1 and 2.8.5 (tried both)
Beta Was this translation helpful? Give feedback.
All reactions