logo
down
shadow

Safari caching pages too heavily, how to add expires header using rails


Safari caching pages too heavily, how to add expires header using rails

By : user3851744
Date : October 15 2020, 11:12 PM
To fix this issue Normally static files have their modified date appended to the end of them to fix caching issues. Since your file is dynamic you should just add the current time to the end of the path.
This is not supported by javascript_include_tag, so you will need to write the script include tag by hand like so:
code :


Share : facebook icon twitter icon
What is the best Rails caching option for largely static pages with a dynamic header

What is the best Rails caching option for largely static pages with a dynamic header


By : sixmileal
Date : March 29 2020, 07:55 AM
wish helps you What I have done is use page caching, and then make an AJAX call to fetch either:
The entire header. Specific parts of the header that are dynamic.
Add Expires Header in Rails

Add Expires Header in Rails


By : pburczyn
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further You can't affect the expires headers of images served from other domains; the configuration of those assets is up to the administrator of the domain that is serving them.
Add Expires header to rails assets

Add Expires header to rails assets


By : PipTalk team
Date : March 29 2020, 07:55 AM
I wish this helpful for you If you are using Rails 4, then only Cache-Control response header can be set for assets served by Rails. That’s a limitation.
Your solution is working for Rails 5
code :
  def test_serves_files_with_headers
    headers = {
      "Access-Control-Allow-Origin" => "http://rubyonrails.org",
      "Cache-Control"               => "public, max-age=60",
      "X-Custom-Header"             => "I'm a teapot"
    }

    app      = ActionDispatch::Static.new(DummyApp, @root, headers: headers)
    response = Rack::MockRequest.new(app).request("GET", "/foo/bar.html")

    assert_equal "http://rubyonrails.org", response.headers["Access-Control-Allow-Origin"]
    assert_equal "public, max-age=60",     response.headers["Cache-Control"]
    assert_equal "I'm a teapot",           response.headers["X-Custom-Header"]
  end
Chrome & Expires Header - Image Caching

Chrome & Expires Header - Image Caching


By : BhavyaKhandelwal
Date : March 29 2020, 07:55 AM
help you fix your problem I have a web application that contains a few hundred small images, and is performing quite badly on load. , There are 3 ways of loading a page -
How to enable expires-header caching for webview

How to enable expires-header caching for webview


By : Kishore Karnam
Date : March 29 2020, 07:55 AM
wish helps you Most modern browsers will always make a request to the server, even for cached content, just to check if the server has updated content available. In these cases, the browser will include an "If-Modified-Since" header in the request so that the server can quickly return back an empty HTTP 304 response if nothing has changed.
Your options are either 1) Configure your server to evaluate Last-Modified-Since and return 304 as appropriate. This will tell the browser to go ahead and use the cached content. 2) Implement your page loading using javascript and create a custom caching mechanism with localstorage which isn't subject to the whims of browser vendors. This is a bit of work but what I've done successfully on several performance-sensitive projects.
Related Posts Related Posts :
  • Include resize in image_tag with id
  • Redirect to new view with submit_tag in Rails
  • Rails app in EC2 is not reachable but Python is
  • trying to display JSON with 422 error Rails React
  • Nested forms and automatic creation of parent, children
  • Support for multiple domains/subdomains in Rails
  • Model inheritance, the Factory pattern, and self-parsing in Ruby-on-Rails
  • has_many at two levels
  • regular expression to remove substrings delimited by matching double braces
  • What are your crowdsource translation management system recommendations?
  • Show selected name instead of ID in rails index view
  • Rails global content_for
  • rails complex form and ordering with build
  • Given a date, how can I efficiently calculate the next date in a given sequence (weekly, monthly, annually)?
  • What parts of a Ruby-on-Rails application (with reasonably expressive unit tests) should have RDoc?
  • Where to put methods that do simple date formatting
  • What are common ways of implementing web API request throttling/rate-limiting?
  • Linking new users signed in via Facebook connect to existing accounts
  • Rails check if IRB console or webpage
  • As of 2010, what good Rails-based content management systems are there (Typo?)?
  • How to test custom helper in Rails?
  • How can i include image into CSV
  • Rails.cache.fetch, Symbols, & Memcached
  • Polymorphic Join Table in Rails?
  • Returning HTML in the JS portion of a respond_to block throws errors in IE
  • Strange variable-argument problem in Capistrano Task
  • How to specify :primary_key starting value in rails schema migration?
  • Rails3 and Paperclip
  • Multiple tables on one page with prawn
  • friendly_id / content_url without scope
  • has_many :through association through two different associations
  • Installing Ruby choices
  • Rails: Change default format of the date_select helper?
  • Howto change view format based on domain name
  • How to read form-data with ruby
  • How can i implement ROR testing
  • Paypal recurring payment status
  • Continue after exception in RSpec
  • Return embedded documents in query
  • aggregate conditional has_many rails association
  • Calculate thumbnail sizes with RMagick
  • Stored procedure, activerecord, and alternatives?
  • Rails Prawnto PDFs fail to download in Internet Explorer
  • Proper syntax for boolean condition in find
  • How do I get a value from a composite key table using a Rails model?
  • rails 404 422 500 completely blank
  • Elastic css framework with rails 3 and haml/sass?
  • Override rails render method and replace content
  • What is the difference between Ruby on Rails and Grails?
  • How to create a full Audit log in Rails for every table?
  • configuring .gems file (rails apps on Heroku)
  • Ruby on Rails: Is it possible to :include the other leg of a circular join table?
  • I am trying to deploy my first rails app using Capistrano and am getting an error
  • How do I make a ruby gem available to my scripts?
  • How to create Rails models with multiple complex associations/joins?
  • ruby-on-rails: Seeding-data strategies (or loading test data into developer database)
  • Resque or Gearman - choosing the right tool for background jobs
  • What is the best way to store an ActiveRecord object in memcached?
  • Rails - restrict URL access to images?
  • Fields_for dynamic label
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org