bminer / node-static-asset

Static asset manager for Node.JS and Express
MIT License
48 stars 13 forks source link

Max-age being set to 0 #20

Closed jkieley closed 8 years ago

jkieley commented 8 years ago

I am using the default Express configuration for express version: 4.13.1 I followed your setup instructions, snippet from my app.coffee

app.use staticAsset('public') app.use express.static('public')

script type="text/javascript" src={this.props.assetFingerprint('js/bootstrap.min.js')}></script

(being used with reactjs) I see the fingerprint is being generated correctly but the cache headers are not being set, specifically the max-age is being set to 0

jkieley commented 8 years ago

it turns out that when calling the assetFingerprint function including a leading slash, fixed the issue: like this: script type="text/javascript" src={this.props.assetFingerprint('/js/bootstrap.min.js')}></script

not like this: script type="text/javascript" src={this.props.assetFingerprint('js/bootstrap.min.js')}></script