React images load locally but not on AWS Amplify

二次信任 提交于 2021-02-11 06:18:27

问题


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}/>

Locally I am met with

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

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

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

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


回答1:


Go to App Settings -> Redirects and Rewrites and change the

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

Type from 200 (Rewrite) to 404 (Rewrite)



来源:https://stackoverflow.com/questions/64146914/react-images-load-locally-but-not-on-aws-amplify

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!