Project

General

Profile

Actions

Defect #24617

closed

Browser js/css cache remains after upgrade

Added by Hiroshi Shirosaki over 7 years ago. Updated over 1 year ago.

Status:
Closed
Priority:
Normal
Category:
UI
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed
Affected version:

Description

Browser js/css cache remains after Redmine application upgrade.

Asset path parameter like "?1481777729" is not added with Rails 4.2.
Adding asset id parameters like old Rails 3 would solve the issue.

<script src="/redmine/javascripts/application.js?1481777729"></script>

Attached patch is based on:
http://apidock.com/rails/ActionView/Helpers/AssetTagHelper/rails_asset_id

Redmine version is 3.3.1.devel.


Files


Related issues

Related to Redmine - Defect #29625: application.css imported by themes not covered by cache control versioningNew

Actions
Actions #1

Updated by Toshi MARUYAMA about 7 years ago

Good Job!!
Is it related that Redmine does not use asset pipeline?

Actions #2

Updated by luigifab ! about 7 years ago

+1 Very good patch.

Actions #3

Updated by Go MAEDA about 7 years ago

  • Target version set to 3.4.0
Actions #4

Updated by Akipii Oga about 7 years ago

+1
When upgrading Redmine(2.x→3.x), the screen may collapse.
If you fix with this patch, I want you to merge quickly.

Actions #5

Updated by Toshi MARUYAMA about 7 years ago

Toshi MARUYAMA wrote:

Good Job!!
Is it related that Redmine does not use asset pipeline?

Ref: #13927#note-2

Actions #6

Updated by Pavel Rosický about 7 years ago

toshio harita - why is the asset pipeline disabled?

btw. suffixes like "filename ?1481777729 " are just ignored and still cached by some web-servers.

http://guides.rubyonrails.org/asset_pipeline.html - using a file digest is safer then using timestamps
ex. https://redmine.org/assets/myasset- 66ca44f5c66abebe01f39e780e5b89159a04e7019c4515792224dd4cae962bbc .js

Actions #7

Updated by Toshi MARUYAMA about 7 years ago

Pavel Rosický wrote:

toshio harita - why is the asset pipeline disabled?

As #13927#note-3, we don't know how to port asset in plugins.

Actions #8

Updated by Kohei Nakamura about 7 years ago

+1 Great Job!

I was also upgrading to Redmine 2.5.1 to 3.3.2, Redmine layout collapsed!
I did not understand the cause and attempted to cancel the version upgrade.

However, Go MAEDA taught me this patch,

Upgrade succeeded.

I would like to apply the patch so that nobody suffers from this problem.


In my case, I applied this patch by the following procedure.
(Redmine 3.3.2)

#cd redmine/config/initilizers
#wget http://www.redmine.org/attachments/download/17275/0001-Adds-asset_id-parameters-to-assets.patch
#patch -u < 0001-Adds-asset_id-parameters-to-assets.

and input redmine/config/initializers/10-patches.rb

#bundle exec rake tmp:cache:clear tmp:sessions:clear
Apache restart(Redmine Restart).
View source in the browser and confirm that it has a parameter string.
(ex. ***.js.?1486805824)
Actions #9

Updated by Marius BĂLTEANU about 7 years ago

I didn't test the patch, but the functionality is really needed. Currently, we use a workaround with a pagespeed module for nginx in order to purge the cache after a release with js/css changes.

Actions #10

Updated by Jean-Philippe Lang almost 7 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Patch committed, thanks.

Actions #11

Updated by Go MAEDA almost 7 years ago

  • Category set to UI

Since the problem adversely affects web UI, I am setting category field to "UI".

Actions #12

Updated by Greg T over 6 years ago

This patch doesn't seem to effect @import url(../../../stylesheets/application.css); in themes, so I still have to add a Cache-Control header.

<IfModule mod_deflate.c>
#    DeflateAlterETag NoChange
    RequestHeader edit "If-None-Match" '^"((.*)-gzip)"$' '"$1", "$2"'
</IfModule>
<filesMatch "application\.css$">
  <ifModule mod_headers.c>
     Header set Cache-Control "max-age=60, must-revalidate" 
  </ifModule>
</filesMatch>
Actions #13

Updated by Go MAEDA over 5 years ago

  • Related to Defect #29625: application.css imported by themes not covered by cache control versioning added
Actions

Also available in: Atom PDF