Path: blob/master/lib/rammerhead/holy-config.js
5227 views
'use strict';12const cookie = require('cookie');34module.exports = {5//// HOSTING CONFIGURATION ////67bindingAddress: "0.0.0.0",8port: process.env.PORT || 3000,9crossDomainPort: null,10publicDir: null,1112ssl: null,1314// this function's return object will determine how the client url rewriting will work.15// set them differently from bindingAddress and port if rammerhead is being served16// from a reverse proxy.17getServerInfo: (req) => {18const { origin_proxy } = cookie.parse(req.headers.cookie || '');1920let origin;2122try {23origin = new URL(origin_proxy);24} catch (error) {25origin = new URL(`${req.socket.encrypted ? 'https:' : 'http:'}//${req.headers.host}`);26}2728const { hostname, port, protocol } = origin;2930return {31hostname,32port,33crossDomainPort: port,34protocol35};36},3738password: null,3940// disable or enable localStorage sync (turn off if clients send over huge localStorage data, resulting in huge memory usages)41disableLocalStorageSync: false,4243// restrict sessions to be only used per IP44restrictSessionToIP: false,4546//// REWRITE HEADER CONFIGURATION ////4748stripClientHeaders: [49'cf-ipcountry',50'cf-ray',51'x-forwarded-proto',52'cf-visitor',53'cf-connecting-ip',54'cdn-loop',55'x-forwarded-for'56],57rewriteServerHeaders: {58// you can also specify a function to modify/add the header using the original value (undefined if adding the header)59// 'x-frame-options': (originalHeaderValue) => '',60'x-frame-options': null // set to null to tell rammerhead that you want to delete it61},6263//// LOGGING CONFIGURATION ////6465// valid values: 'disabled', 'debug', 'traffic', 'info', 'warn', 'error'66generatePrefix: (level) => `[${new Date().toISOString()}] [${level.toUpperCase()}] `,6768// logger depends on this value69getIP: (req) => (req.headers['x-forwarded-for'] || req.connection.remoteAddress || '').split(',')[0].trim()70};717273