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

301s are returned as 404s #631

Closed
reydavidww opened this issue Mar 25, 2021 · 1 comment
Closed

301s are returned as 404s #631

reydavidww opened this issue Mar 25, 2021 · 1 comment

Comments

@reydavidww
Copy link

I am checking sitemap links and would like to have the test to return only 4xx and 5xx statuses. Anyways, the http statuses for a lot of 301s are reported as 404 instead, like

$ curl -I 'https://www.weightwatchers.com/us/article/10-min-barre-workout?bypasscache=1616690631' returns a 301 not a 404. This is reporting false positives.

HTTP/2 301 
cache-control: max-age=86400
content-type: text/html; charset=utf-8
location: /us/10-min-barre-workout?bypasscache=1616690631
via: 1.1 varnish, 1.1 varnish
access-control-allow-origin: *
accept-ranges: bytes
date: Thu, 25 Mar 2021 20:04:17 GMT
age: 12024
x-served-by: cache-dca12926-DCA, cache-bos4626-BOS
x-cache: MISS, HIT
x-cache-hits: 0, 1
x-timer: S1616702658.965654,VS0,VE3
strict-transport-security: max-age=31557600
content-length: 0

would you guys be able to fix this to report correct status when it's 3xx'ing

@gjtorikian
Copy link
Owner

You're not following redirects in your curl call. Try this:

curl -L -I 'https://www.weightwatchers.com/us/article/10-min-barre-workout?bypasscache=1616690631'

And you should see the 404 as well. Visiting this URL in the browser confirms this.

If for some reason you do not want to follow redirects, you can disable them by passing the following options:

:typhoeus =>
      {
        :followlocation => false
      }

Alternatively you can also pass http_status_ignore: [301] to just ignore 301s.

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

2 participants