Patch #37748

Favicon takes a long time to load

Added by Gasper C about 1 month ago. Updated about 1 month ago.

Status:NewStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-

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:

favicon.diff Magnifier (791 Bytes) Gasper C, 2022-10-04 12:54

after.png (62.2 KB) Gasper C, 2022-10-04 12:55

before.png (65.2 KB) Gasper C, 2022-10-04 12:55

History

#1 Updated by Go MAEDA about 1 month 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

Also available in: Atom PDF