From 6f1cadcd25ed59b69a84184c0f32cb87a7524482 Mon Sep 17 00:00:00 2001 From: Jacob Bare Date: Tue, 14 Aug 2018 11:10:25 -0500 Subject: [PATCH] Force https in prod, do not delete host --- package.json | 2 +- src/apollo/config.js | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index f40d3f9..d3e704f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "fortnight-web", - "version": "1.0.0-rc.2", + "version": "1.0.0-rc.2.1", "main": "index.js", "author": "Jacob Bare ", "license": "MIT", diff --git a/src/apollo/config.js b/src/apollo/config.js index 8f2cd89..20d1545 100644 --- a/src/apollo/config.js +++ b/src/apollo/config.js @@ -5,11 +5,12 @@ import fetch from 'isomorphic-unfetch'; export default (req) => { const headers = req ? req.headers : {}; - const uri = (req) ? `${req.protocol}://${req.get('host')}` : ''; - if (headers.host) { - headers['x-forwarded-host'] = headers.host; - delete headers.host; - } + const protocol = process.env.NODE_ENV === 'production' ? 'https' : 'http'; + const uri = (req) ? `${protocol}://${req.get('host')}` : ''; + // if (headers.host) { + // headers['x-forwarded-host'] = headers.host; + // delete headers.host; + // } return { link: ApolloLink.from([ onError(({ graphQLErrors, networkError }) => {