0

I have an App Engine server, and I need to load the favicon. I tested it locally, and for some reason, it doesn't work in the browser even though I followed many tutorials even on stack overflow. any ideas why? app.yaml:

runtime: nodejs16
handlers:
# Serve all static files with url ending with a file extension
- url: /(.*\..+)$
  static_files: \1
  upload: (.*\..+)$
  # - url: /favicon\.ico
  # static_files: favicon.ico
  # upload: favicon\.ico
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico
- url: /static
  static_dir: public

# Catch all handler to index.html
- url: /.*
  static_files: index.html
  upload: index.html

And I'm loading the favicon like this:

<link rel="icon" href="/favicon.ico" type="image/x-icon"/>

And my folder structure is this:

-build
--index.html
--app.yaml
--favicon.ico
--manifest.json
--robots.txt
--static
---css
---js
---media
...
Itamar Cohen
  • 340
  • 4
  • 15
  • Browser cache. Use curl to verify **curl https://example.com/favicon.ico** If that works, then try a hard refresh in the browser. If it does not work with curl, then look in the logs to see the error. Note: you do not need to escape the file name, use **favicon.ico** instead of **favicon\.ico**. Also read this answer: https://stackoverflow.com/a/62715515/8016720 – John Hanley Dec 21 '21 at 19:59
  • What do you mean by hard refresh? I checked, the favicon is there, but it is just not displaying – Itamar Cohen Dec 22 '21 at 05:19
  • Nevermind, it worked, I hard refreshed the page and it displayed, thank you very much! – Itamar Cohen Dec 22 '21 at 05:50

0 Answers0