0

I've been trying to deploy a very simple flask app onto AWS. But I just can't seem to make it work. It always gives me the same error that favicon.ico is not found in the console and gives me a 502 bad gateway error.

Solutions I've tried:

  1. Tried saving it to Amazon S3 bucket and reference it from there. Didn't work. Gave me the same error.

base.html has the following line

<link rel="icon" type="image/png" href="https://elasticbeanstalk-us-east-1-503477540785.s3.amazonaws.com/favicon.ico">

application.py has the following route

@application.route('/favicon.ico')
def favicon():
  return Response(headers={'Location': 'https://elasticbeanstalk-us-east-1-503477540785.s3.amazonaws.com/favicon.ico'}, status=200)

I tried changing the status to 301 too, didn't change anything.

When I try to go to local-website/favicon.ico, it redirects me to https://elasticbeanstalk-us-east-1-503477540785.s3.amazonaws.com/favicon.ico. But when I save it locally and try to go to the same url, the .ico file loads up at http://127.0.0.1:5000/favicon.ico.

How do I make this work?

  • If you are storing images on static file then [this](https://stackoverflow.com/questions/15077489/static-assets-dont-show-up-for-flask-on-elastic-beanstalk) might help. – Smit Parmar May 19 '22 at 11:38

0 Answers0