Skip to content

Commit

Permalink
Default response header Cache-Control to 1 day in production;disable …
Browse files Browse the repository at this point in the history
…response cache in __DEV__
  • Loading branch information
buildbreakdo committed Apr 27, 2017
1 parent 9b3d9c8 commit 50ef669
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ app.get('*', async (req, res, next) => {
apiUrl: config.api.clientUrl,
};

if (__DEV__) {
res.set('Cache-Control', 'private, no-cache, no-store, must-revalidate');
res.set('Expires', '-1');
res.set('Pragma', 'no-cache');
} else {
res.set('Cache-Control', 'private, max-age=86400');
}

const html = ReactDOM.renderToStaticMarkup(<Html {...data} />);
res.status(route.status || 200);
res.send(`<!doctype html>${html}`);
Expand Down

0 comments on commit 50ef669

Please sign in to comment.