Imgur图片返回403 [英] Imgur images returning 403

查看:63
本文介绍了Imgur图片返回403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在制作一个React应用,最近每次尝试像这样从imgur访问图像

I've been making a react app and recently whenever I try to access images from imgur like so

this.setState({
  imgUrl: `https://i.imgur.com/${this.props.image.id}b.png`,
  imgBigUrl: `https://i.imgur.com/${this.props.image.id}l.png`
});

它正在这样渲染

<img src={this.state.imgUrl}/>

但是我一直禁止403,但是当我使用邮递员或在浏览器中访问它时就可以了.我还通过传递相册网址(如

But I keep getting 403 forbidden, but when I use postman or visit it in the browser it's fine. I'm also accessing the API by passing in an album url like

https://imgur.com/gallery/zrUFj

并从那里获取所有图像以显示在应用程序中(我收到403错误)

and getting all the images from there to be displayed in the app (where i get 403 errors)

我不确定我在哪里可能做错了什么,我还尝试获取API授权的新客户端ID,但仍无法正常工作.有人有建议吗?

I'm unsure where I could be have done something wrong, I've also tried getting a new client ID for the API authorization, still hasn't worked. Anyone have any suggestions?

推荐答案

Imgur的CDN似乎限制了对来自 127.0.0.1 引用者的图像的访问.已向他们报告这是一个问题(服务器配置的问题).

Imgur's CDN seems to restrict access to images from a 127.0.0.1 referer. This has been reported to them as an issue (matter of server configuration).

同时尝试将您的开发服务器主机从 127.0.0.1 更改为 localhost 或您的真实IP地址.

Meanwhile try to change your dev server host from 127.0.0.1 to localhost or maybe your real IP address.

这篇关于Imgur图片返回403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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