问题
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