Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7014353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:30:37+00:00 2026-05-27T22:30:37+00:00

My heroku website’s root page is essentially static, it has some ruby code in

  • 0

My heroku website’s root page is essentially static, it has some ruby code in the view when its generated, but there’s nothing specific to a single user, so I’d like to have it cached by Varnish and served up without hitting my dyno (note that there are other pages that are dynamic in the application).

Heroku makes it seem very simple here. Just add response.headers['Cache-Control'] = 'public, max-age=300' and it’ll cache for 5 minutes before regenerating.

To test this I made the changed and outputted the date (Time.now) to the page, to see if it would remain the same for 5 minutes, but every time I access the page on a new browser it updates. Refreshing on the same browser works fine, but I think that’s because of the browser caching, not Heroku.

If it’s any help, when I do a curl -i to get the HTTP headers, I get this:

HTTP/1.1 200 OK^M
Server: nginx/0.7.67^M
Date: Thu, 29 Dec 2011 02:03:33 GMT^M
Content-Type: text/html; charset=utf-8^M
Connection: keep-alive^M
Cache-Control: public, max-age=300^M
X-Ua-Compatible: IE=Edge^M
Etag: "8a1b58f048968803980417a2914764d0"^M
X-Runtime: 0.038393^M
Content-Length: 8310^M
X-Varnish: 1040651825^M
Age: 0^M
Via: 1.1 varnish^M

Basically, I’d like to make sure that it’s generated once and then cached in Varnish, am I missing any options, do I have to configure something more? If you have other suggestions for serving a fast static page I’d love those as well.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:30:38+00:00Added an answer on May 27, 2026 at 10:30 pm

    The problem turned out to be that Heroku has a number of Varnish servers, so it takes about 10-15 page refreshes until the page was cached on all of the servers, after that it would stay cached. It was working all along, I just gave up after a few refreshes didn’t work.

    I also increased the max_age so that I could see it more clearly, a 5 minute cache has almost no effect.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Rails 3 website, for which the home page is static content
My website works fine on my local mashine but crashes on heroku. Here is
After renaming my heroku app from the heroku website, whenever I cd to its
I am developing a ruby on rails website using heroku and git. What tools
My site is deployed on heroku. Time.now will return today, but the created_at field
I just deployed my Rails app to Heroku, but the Javascripts that were using
I have configured my domain to heroku IPs 75.101.163.44 75.101.145.87 174.129.212.2 But it's not
I created two very simple Heroku apps to test out the service, but it's
Once you have uploaded your source code to Heroku, is it possible to download
I've followed the guide on Heroku's website to get a node server running using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.