React映像在本地加载,但不在AWS Amplify上加载 [英] React images load locally but not on AWS Amplify

查看:83
本文介绍了React映像在本地加载,但不在AWS Amplify上加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用API​​来检索图像的URL.然后,我试图将该网址传递给标签如下:

Hi I am working with an API that retrieves the URL of an image. I am then trying to pass that URL into an tag as follows:

<img class="img-fluid" src={this.state.representatives[i].pic}/>

我在当地遇见

但是当我尝试在AWS Amplify上使用该应用程序时,我遇到了:

But when I try to use the app on AWS Amplify, I am met with:

我尝试将URL硬编码到应用程序中,但返回相同的错误.我真的很困惑从这里去哪里.

I have tried hardcoding the URL into the app but it returns the same error. I am really confused where to go from here.

例如,从Mark Warner的API中提取的图像URL是 http://bioguide.congress.gov/bioguide/photo/W/W000805.jpg

For example the image URL pulled from the API for Mark Warner is http://bioguide.congress.gov/bioguide/photo/W/W000805.jpg

,我知道我不会弄乱这个URL,因为它是在本地加载的.我在某个地方犯了一个简单的错误吗?

and I know I am not messing with this URL as it loads locally. Am I making a simple error somewhere?

推荐答案

转到应用设置->重定向和重写并更改

源地址:</^ [^.] + $ |.(?!(css | gif | ico | jpg | js | png | txt | svg | woff | ttf | map | json)$)([^.] + $)/>

source address: </^[^.]+$|.(?!(css|gif|ico|jpg|js|png|txt|svg|woff|ttf|map|json)$)([^.]+$)/>

类型从200(重写)到404(重写)

Type from 200 (Rewrite) to 404 (Rewrite)

这篇关于React映像在本地加载,但不在AWS Amplify上加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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