- Where Developers Learn, Share, & Build Careers
I am currently running an octopus site (jacail-based) on the cedar stack of Heroku. The code resides here:
I want to apply a set both I have managed to set My Ways to set long term captions for fixed assets and to set an arbitrary endless header for your main content on Heroes: gemfile: gem 'rack-contrib' code> config.ru: By default you will end 2 years (static / stylesheet, static / images) for the content listed in the URL array. e.t.c.). You have to move public / static from / because otherwise you are fighting unnecessarily with Herod's Enganx config (the right place to apply these types of unnecessary settings). I know you said that you are trying not to use rack contrit but it does not make any sense to do so, there is no harm in using a small line line library. . "Properly" will host static content on an environment where you can configure nginx, and the second best method is to keep your static file path so that Heroko ignores it, and uses the blank position Provides static files with those headers you want. - It should also be evident, just changing the name of your public folder will allow you to do this through routes, and the normal Sinatra function will end. But I'm using Static Catch because it's less verbose (The real issue is that Heroko is not giving NGN to your app to request the public, I believe.) < / Div> cache-control header based on the selected file type:
. Html files
public, max-age = 3600
.css | .js | .png Get the value of .ico (etc)
public, maximum-age = 604800 - Alternatively, I will call this rule as
/ stylesheets, "/ javascripts", / Imgs' directory to do anything.
: static_cache_control, [: public ,: max_age => 3600] and just vanilla
cash_transdown: public, max_age = & gt; 3600 Details with no luck.
public, maximum-age = 3600 on articles (such as
/ 2012 / lazy-sunday / ) But have not been able to get the header to apply to CSS / JS (like
/stylesheets/screen.css )
Updated ):
'Bundler / Setup' is required 'sinatra / base' # Project Root Directory $ root = :: File Dima (__ file __) class Sinatra stratuset server & lt; Sinatra :: Base Mill (/. + /) Cash_trash: public, max_age = & gt; 7200 send_sinatra_file (request.path) {404} end not_found send_sinatra_file ('404.html') {"Sorry, I can not get # {request.path}}"} cache_control: no_cache, max_age = & gt; File_path = ~ / \) file interval (path, and missing_file_back) file_path = file. (File.derenname (__file__), 'public', path) file_path = File.join (file_path, 'index.html') file_path = [Az] + $ / i file The oysters (File_path)? Send_file (file_path): missing_file_block.call use the end end rack :: deflector run sinatra stringic server
is required 'rack / content' get '* .html' do | Page | # Whatever code you need to complete your main pages goes here # Use the rack: File: I think page termination # Set the Content Header for that content ... before 5001 Timelines expire: Public:: Required_Required End # Property / Stylesheet (domain.com/stylesheets) Assets # Rack is provided by static cache, with the expiry of the default 2 year. Use rack :: Static cache, url = & gt; ["/ Stylesheets"] ,: Root = & gt; Dir.pwd + '/ static' Run Sinatra :: App
Comments
Post a Comment