Feat: News in the client app (#34392)

This commit is contained in:
Stuart Taylor
2018-11-29 12:12:15 +00:00
committed by Valeriy
parent 28798dc008
commit d327a5c36b
87 changed files with 2334 additions and 1403 deletions

View File

@@ -6,9 +6,17 @@ import { homeLocation } from '../../../config/env';
import { wrapHandledError } from '../utils/create-handled-error';
// We need to tunnel through a proxy path set up within
// the gatsby app, at this time, that path is /internal
const whiteListRE = new RegExp([
'^/internal/n/',
'^/internal/p\??'
].join('|'));
export default () => function authorizeByJWT(req, res, next) {
const path = req.path.split('/')[1];
if (/^external$|^internal$/.test(path)) {
if (/^external$|^internal$/.test(path) && !whiteListRE.test(req.path)) {
const cookie = req.signedCookies && req.signedCookies['jwt_access_token'] ||
req.cookie && req.cookie['jwt_access_token'];
if (!cookie) {