config to disable referrer check for local dev environment

merge-requests/208/head
fatchan 5 years ago
parent dab1ae7574
commit 7d7f43373e
  1. 7
      configs/main.json.example
  2. 2
      server.js

@ -1,10 +1,11 @@
{
"dbURL": "mongodb://username:password@host:port",
"port": 7000,
"sessionSecret": "long random string",
"dbURL": "mongodb://username:password@host:port",
"port": 7000,
"sessionSecret": "long random string",
"tripcodeSecret": "long random string",
"ipHashSecret": "long random string",
"cacheTemplates": true,
"refererCheck": false,
"refererRegex": "^https?:\\/\\/(?:www\\.)?domain\\.com\\/",
"openGraph": {
"siteName": "site name",

@ -58,7 +58,7 @@ const express = require('express')
if (req.method !== 'POST') {
return next();
}
if (!req.headers.referer || !req.headers.referer.match(refererRegex)) {
if (configs.refererCheck === true && (!req.headers.referer || !req.headers.referer.match(refererRegex))) {
return res.status(403).render('message', {
'title': 'Forbidden',
'message': 'Invalid or missing "Referer" header. Are you posting from the correct URL?'

Loading…
Cancel
Save