Reputation: 20409
I have the following in my app.yaml (python is used):
handlers:
- url: /ico/
static_dir: templates/ico
So, favicon.ico is located as templates\ico\favicon.ico. HTML files (also located at templates folder, but used as templates from the main app) refer to this file as
<link rel="shortcut icon" href="ico/favicon.ico">
or
<link rel="shortcut icon" href="/ico/favicon.ico">
(depends on final URL)
And favicon is displayed. Should I define it additionally as
handlers:
- url: /favicon\.ico
static_files: templates/ico/favicon.ico
upload: templates/ico/favicon\.ico
What is the reason, if so?
Upvotes: 2
Views: 1140
Reputation: 37259
Yes, you should define it additionally as you mention (as a handler at the root level). My understanding is that the favicon is traditionally served from the root directory of a site in general (even outside of App Engine), and therefore the path /favicon.ico
will be called by the browser when loading the site (I'm not an expert, so take this with a grain of salt). Therefore in order to prevent that error, you must provide a handler for that specific path that serves your favicon.
Upvotes: 4