Patch #37748
closedFavicon takes a long time to load
0%
Description
I'm using passenger standalone and nginx as proxy webserver. Redmine is v5.0.2.
I've noticed that favicon isn't cached, and takes a ridiculous amount to load (~30ms).
While caching should be configured at webserver level, I've noticed that when I remove versioning from the favicon, it only takes about 4ms to load it.
This is a simple patch, maybe it would be better to remove some more of the code related to favicon, but I'm not familiar with ruby.
Before:
After:
Files
Related issues
Updated by Go MAEDA about 2 years ago
The following code will also work if a third-party theme provides a favicon.
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index ced1845eb..2ae3f1beb 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1752,7 +1752,7 @@ module ApplicationHelper
# Returns the path to the favicon
def favicon_path
icon = (current_theme && current_theme.favicon?) ? current_theme.favicon_path : '/favicon.ico'
- image_path(icon)
+ asset_path(icon)
end
# Returns the full URL to the favicon
Updated by Go MAEDA 5 months ago
- Status changed from New to Closed
I think the issue was solved with the introduction of Propshaft (#39111).
With Propshaft, instead of appending an asset id as a query string (e.g. favicon.ico?1679302129
), a hash value is now included in the file name (e.g. favicon-0e291875c213c5e776c5a68be4c078acb14453a1.ico
). As a result, the favicon will be effectively cached in the browser.
Updated by Go MAEDA 5 months ago
- Related to Feature #39111: Enable Asset Pipeline Integration using Propshaft added