使用工具时 URL 被禁止 403 但浏览器没问题 [英] URL forbidden 403 when using a tool but fine from browser

查看:22
本文介绍了使用工具时 URL 被禁止 403 但浏览器没问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些图像需要执行 HttpRequestMethod.HEAD 以找出图像的一些详细信息.

I have some images that I need to do a HttpRequestMethod.HEAD in order to find out some details of the image.

当我在浏览器上访问图片网址时,它可以正常加载.

When I go to the image url on a browser it loads without a problem.

当我尝试通过我的代码或通过在线工具获取标题信息时失败

When I attempt to get the Header info via my code or via online tools it fails

示例 URL 是 http://www.adorama.com/images/large/CHHB74P.JPG

如前所述,我使用了在线工具 Hurl.It 来尝试获得 Head 请求,但我得到了我在我的代码中收到了相同的 403 Forbidden 消息.我曾尝试向 Head 请求(用户代理、接受、接受编码、接受语言、缓存控制、连接、主机、Pragma、升级不安全请求)添加许多不同的标头,但这些似乎都不起作用.

As mentioned, I have used the online tool Hurl.It to try and attain the Head request but I am getting the same 403 Forbidden message that I am getting in my code. I have tried adding many various headers to the Head request (User-Agent, Accept, Accept-Encoding, Accept-Language, Cache-Control, Connection, Host, Pragma, Upgrade-Insecure-Requests) but none of this seems to work.

它也无法通过 Hurl.it 执行正常的 GET 请求.同样的 403 错误.

It also fails to do a normal GET request via Hurl.it. Same 403 error.

如果相关,我的代码是一个 c# web 服务并且在 AWS 云上运行(以防万一 adorama 服务器有一些我不知道的针对 AWS 的东西).为了测试这一点,我还启动了一个 ec2(linux box)并运行 curl,它也返回了 403 错误.在我的个人计算机上本地运行 curl 会返回二进制图像,这可能只是图像数据.

If it is relevant, my code is a c# web service and is running on the AWS cloud (just in case the adorama servers have something against AWS that I dont know about). To test this I have also spun up an ec2 (linux box) and run curl which also returned the 403 error. Running curl locally on my personal computer returns the binary image which is presumably just the image data.

为了消除明显的想法,我的代码在许多其他网站上都成功运行,只是这个网站存在问题

And just to remove the obvious thoughts, my code works successfully for many many other websites, it is just this one where there is an issue

知道我需要什么才能下载图像标题而不是 403 吗?

Any idea what is required for me to download the image headers and not get the 403?

推荐答案

同样的问题.

在本地运行顺利.从 AWS 实例执行此操作时,我遇到了同样的问题.

Locally it works smoothly. Doing it from an AWS instance I get the very same problem.

我认为这是 DNS 解析问题(重定向到故障节点).因此,我尝试指定与我的客户端解析的 IP 地址相同的 IP 地址,但没有解决问题.

I thought it was a DNS resolution problem (redirecting to a malfunctioning node). I have therefore tried to specify the same IP address as it was resolved by my client but didn't fix the problem.

我的猜测是 Akamai(在本例中该服务由 Akamai CDN 提供)正在阻止 AWS.不知何故可以理解,客户为CDN按流量付费,滥用它,人们会产生巨额账单.

My guess is that Akamai (the service is provided by an Akamai CDN in this case) is blocking AWS. It is understandable somehow, customers pay by traffic for CDN, by abusing it, people can generate huge bills.

正在连接到 www.adorama.com (www.adorama.com)|104.86.164.205|:80...已连接.

Connecting to www.adorama.com (www.adorama.com)|104.86.164.205|:80... connected.

HTTP request sent, awaiting response... 
HTTP/1.1 403 Forbidden
Server: **AkamaiGHost**
Mime-Version: 1.0
Content-Type: text/html
Content-Length: 301
Cache-Control: max-age=604800
Date: Wed, 23 Mar 2016 09:34:20 GMT
Connection: close
2016-03-23 09:34:20 ERROR 403: Forbidden.

这篇关于使用工具时 URL 被禁止 403 但浏览器没问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆