Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
QuiteAFancyEmerald
GitHub Repository: QuiteAFancyEmerald/Holy-Unblocker
Path: blob/master/lib/rammerhead/holy-config.js
5227 views
1
'use strict';
2
3
const cookie = require('cookie');
4
5
module.exports = {
6
//// HOSTING CONFIGURATION ////
7
8
bindingAddress: "0.0.0.0",
9
port: process.env.PORT || 3000,
10
crossDomainPort: null,
11
publicDir: null,
12
13
ssl: null,
14
15
// this function's return object will determine how the client url rewriting will work.
16
// set them differently from bindingAddress and port if rammerhead is being served
17
// from a reverse proxy.
18
getServerInfo: (req) => {
19
const { origin_proxy } = cookie.parse(req.headers.cookie || '');
20
21
let origin;
22
23
try {
24
origin = new URL(origin_proxy);
25
} catch (error) {
26
origin = new URL(`${req.socket.encrypted ? 'https:' : 'http:'}//${req.headers.host}`);
27
}
28
29
const { hostname, port, protocol } = origin;
30
31
return {
32
hostname,
33
port,
34
crossDomainPort: port,
35
protocol
36
};
37
},
38
39
password: null,
40
41
// disable or enable localStorage sync (turn off if clients send over huge localStorage data, resulting in huge memory usages)
42
disableLocalStorageSync: false,
43
44
// restrict sessions to be only used per IP
45
restrictSessionToIP: false,
46
47
//// REWRITE HEADER CONFIGURATION ////
48
49
stripClientHeaders: [
50
'cf-ipcountry',
51
'cf-ray',
52
'x-forwarded-proto',
53
'cf-visitor',
54
'cf-connecting-ip',
55
'cdn-loop',
56
'x-forwarded-for'
57
],
58
rewriteServerHeaders: {
59
// you can also specify a function to modify/add the header using the original value (undefined if adding the header)
60
// 'x-frame-options': (originalHeaderValue) => '',
61
'x-frame-options': null // set to null to tell rammerhead that you want to delete it
62
},
63
64
//// LOGGING CONFIGURATION ////
65
66
// valid values: 'disabled', 'debug', 'traffic', 'info', 'warn', 'error'
67
generatePrefix: (level) => `[${new Date().toISOString()}] [${level.toUpperCase()}] `,
68
69
// logger depends on this value
70
getIP: (req) => (req.headers['x-forwarded-for'] || req.connection.remoteAddress || '').split(',')[0].trim()
71
};
72
73