Created
March 23, 2019 03:43
-
-
Save areai51/489c50b29b5c231a92b99ce75043d03b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require('path'); | |
| const fetchTemplateFs = require('node-tailor/lib/fetch-template'); | |
| const ACCEPT_HEADERS = [ | |
| 'accept-language', | |
| 'referer', | |
| 'user-agent', | |
| 'x-request-uri', | |
| 'x-request-host', | |
| 'cookie', | |
| ]; | |
| module.exports = { | |
| fetchTemplate: fetchTemplateFs( | |
| path.join(__dirname, '../..', 'templates'), | |
| () => 'app-shell', | |
| ), | |
| filterRequestHeaders: (attributes, request) => { | |
| const { public: publicFragment } = attributes; | |
| const { headers = {} } = request; | |
| return publicFragment | |
| ? {} | |
| : ACCEPT_HEADERS.reduce((newHeaders, key) => { | |
| headers[key] && (newHeaders[key] = headers[key]); | |
| return newHeaders; | |
| }, {}); | |
| }, | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment