fix: set correct protocol in ssr

This commit is contained in:
Sérgio Ramos 2018-03-26 11:56:04 +01:00
parent 86e60e6c5f
commit 1298652193
8 changed files with 77 additions and 63 deletions

View File

@ -1,6 +1,6 @@
{
"name": "my-joy-images",
"version": "1.4.0",
"version": "1.4.2",
"private": true,
"license": "MPL-2.0",
"repository": "github:yldio/joyent-portal",

View File

@ -10,12 +10,17 @@ const { default: createStore } = require('./state/redux-store');
const indexFile = path.join(__dirname, '../../build/index.html');
const assets = require('../../build/asset-manifest.json');
const { NODE_ENV = 'development' } = process.env;
const getState = request => {
const { req } = request.raw;
const { headers } = req;
const { host } = headers;
const protocol = NODE_ENV === 'development' ? 'http:' : 'https:';
const _font = get(theme, 'font.href', () => '');
const _mono = get(theme, 'monoFont.href', () => '');
const _addr = url.parse(`http://${req.headers.host}`);
const _addr = url.parse(`${protocol}//${host}`);
const _theme = Object.assign({}, theme, {
font: Object.assign({}, theme.font, {

View File

@ -1,6 +1,6 @@
{
"name": "my-joy-instances",
"version": "2.3.0",
"version": "2.3.2",
"private": true,
"license": "MPL-2.0",
"repository": "github:yldio/joyent-portal",

View File

@ -10,12 +10,17 @@ const { default: createStore } = require('./state/redux-store');
const indexFile = path.join(__dirname, '../../build/index.html');
const assets = require('../../build/asset-manifest.json');
const { NODE_ENV = 'development' } = process.env;
const getState = request => {
const { req } = request.raw;
const { headers } = req;
const { host } = headers;
const protocol = NODE_ENV === 'development' ? 'http:' : 'https:';
const _font = get(theme, 'font.href', () => '');
const _mono = get(theme, 'monoFont.href', () => '');
const _addr = url.parse(`http://${req.headers.host}`);
const _addr = url.parse(`${protocol}//${host}`);
const _theme = Object.assign({}, theme, {
font: Object.assign({}, theme.font, {

View File

@ -58,8 +58,6 @@ exports.register = async server => {
Fs.access(publicPathname, Fs.constants.R_OK)
);
console.log({ publicPathname });
if (!err1) {
return h.file(publicPathname, {
confine: publicRoot
@ -71,8 +69,6 @@ exports.register = async server => {
Fs.access(buildMapPathname, Fs.constants.R_OK)
);
console.log({ buildMapPathname });
if (!err2) {
return h.file(buildMapPathname, {
confine: buildStatic

View File

@ -1,6 +1,6 @@
{
"name": "my-joy-navigation",
"version": "2.3.1",
"version": "2.3.3",
"private": true,
"license": "MPL-2.0",
"main": "lib/index.js",

View File

@ -13,7 +13,7 @@ const {
} = process.env;
const PORT = REACT_APP_GQL_PORT ? `:${REACT_APP_GQL_PORT}` : '';
const URI = `${REACT_APP_GQL_PROTOCOL}://${REACT_APP_GQL_HOSTNAME}${PORT}/graphql`;
const URI = `${REACT_APP_GQL_PROTOCOL}://${REACT_APP_GQL_HOSTNAME}${PORT}/navigation/graphql`;
const cache = new InMemoryCache();
const remote = new HttpLink({ uri: URI });

114
yarn.lock
View File

@ -341,12 +341,13 @@ ajv@^5.0.0, ajv@^5.1.0, ajv@^5.1.5, ajv@^5.2.0, ajv@^5.2.3, ajv@^5.3.0:
json-schema-traverse "^0.3.0"
ajv@^6.0.1, ajv@^6.1.0:
version "6.3.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.3.0.tgz#1650a41114ef00574cac10b8032d8f4c14812da7"
version "6.4.0"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.4.0.tgz#d3aff78e9277549771daf0164cff48482b754fc6"
dependencies:
fast-deep-equal "^1.0.0"
fast-json-stable-stringify "^2.0.0"
json-schema-traverse "^0.3.0"
uri-js "^3.0.2"
align-text@^0.1.1, align-text@^0.1.3:
version "0.1.4"
@ -386,8 +387,8 @@ ansi-escapes@^1.0.0, ansi-escapes@^1.1.0, ansi-escapes@^1.4.0:
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-1.4.0.tgz#d3a8a83b319aa67793662b13e761c7911422306e"
ansi-escapes@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.0.0.tgz#ec3e8b4e9f8064fc02c3ac9b65f1c275bda8ef92"
version "3.1.0"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.1.0.tgz#f73207bb81207d75fd6c83f125af26eea378ca30"
ansi-html@0.0.7:
version "0.0.7"
@ -434,28 +435,28 @@ apart@^1.0.1:
resolved "https://registry.yarnpkg.com/apart/-/apart-1.0.1.tgz#97ae56938c71c113ae09c0feafb5f5af84eba063"
apollo-cache-inmemory@^1.1.9:
version "1.1.11"
resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.1.11.tgz#2a96ad076f40575d622c4a45b1eeced18b2dc8ec"
version "1.1.12"
resolved "https://registry.yarnpkg.com/apollo-cache-inmemory/-/apollo-cache-inmemory-1.1.12.tgz#ab489bf046b3e026556ab28bdebb6e010cac9531"
dependencies:
apollo-cache "^1.1.6"
apollo-utilities "^1.0.10"
graphql-anywhere "^4.1.7"
apollo-cache "^1.1.7"
apollo-utilities "^1.0.11"
graphql-anywhere "^4.1.8"
apollo-cache@^1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.6.tgz#b953488bcc8244e001b9ab9c8b362a1512e9203f"
apollo-cache@^1.1.7:
version "1.1.7"
resolved "https://registry.yarnpkg.com/apollo-cache/-/apollo-cache-1.1.7.tgz#5817018a2fbfc05a21ba319bd17a3e7538110cc5"
dependencies:
apollo-utilities "^1.0.10"
apollo-utilities "^1.0.11"
apollo-client@^2.2.5:
version "2.2.7"
resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.2.7.tgz#d5adbda81ef1f1c9c105ac71227ca8dc42b5731b"
version "2.2.8"
resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-2.2.8.tgz#b604d31ab2d2dd00db3105d8793b93ee02ce567e"
dependencies:
"@types/zen-observable" "^0.5.3"
apollo-cache "^1.1.6"
apollo-cache "^1.1.7"
apollo-link "^1.0.0"
apollo-link-dedup "^1.0.0"
apollo-utilities "^1.0.10"
apollo-utilities "^1.0.11"
symbol-observable "^1.0.2"
zen-observable "^0.7.0"
optionalDependencies:
@ -495,13 +496,13 @@ apollo-link@^1.0.0, apollo-link@^1.2.1:
apollo-utilities "^1.0.0"
zen-observable-ts "^0.8.6"
apollo-server-module-graphiql@^1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.3.2.tgz#0a9e4c48dece3af904fee333f95f7b9817335ca7"
apollo-server-module-graphiql@^1.3.3:
version "1.3.3"
resolved "https://registry.yarnpkg.com/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.3.3.tgz#5b411922177cd7b7a569655e26c84cc0f0b98e27"
apollo-utilities@^1.0.0, apollo-utilities@^1.0.10, apollo-utilities@^1.0.8:
version "1.0.10"
resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.10.tgz#0c35696891d4fa28d76768e0f7249d63c6da08b9"
apollo-utilities@^1.0.0, apollo-utilities@^1.0.11, apollo-utilities@^1.0.8:
version "1.0.11"
resolved "https://registry.yarnpkg.com/apollo-utilities/-/apollo-utilities-1.0.11.tgz#cd36bfa6e5c04eea2caf0c204a0f38a0ad550802"
apollo@^0.2.2:
version "0.2.2"
@ -1223,8 +1224,8 @@ babel-plugin-minify-type-constructors@^0.3.0:
babel-helper-is-void-0 "^0.3.0"
babel-plugin-module-resolver@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.1.0.tgz#cf7868bd2c1818f855aede16141009b87dd1f95b"
version "3.1.1"
resolved "https://registry.yarnpkg.com/babel-plugin-module-resolver/-/babel-plugin-module-resolver-3.1.1.tgz#881cf67e3d4b8400d5eaaefc1be44d2dc1fe404f"
dependencies:
find-babel-config "^1.1.0"
glob "^7.1.2"
@ -2270,12 +2271,12 @@ caniuse-api@^1.5.2:
lodash.uniq "^4.5.0"
caniuse-db@^1.0.30000529, caniuse-db@^1.0.30000634, caniuse-db@^1.0.30000639:
version "1.0.30000819"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000819.tgz#c3b7dd559e5e6d63d5dcaa62bac6bd04c7619709"
version "1.0.30000820"
resolved "https://registry.yarnpkg.com/caniuse-db/-/caniuse-db-1.0.30000820.tgz#7c20e25cea1768b261b724f82e3a6a253aaa1468"
caniuse-lite@^1.0.30000748, caniuse-lite@^1.0.30000792:
version "1.0.30000819"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000819.tgz#aabee5fd15a080febab6ae5d30c9ea15f4c6d4e2"
version "1.0.30000820"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000820.tgz#6e36ee75187a2c83d26d6504a1af47cc580324d2"
capture-stack-trace@^1.0.0:
version "1.0.0"
@ -2718,8 +2719,8 @@ concat-stream@^1.4.10, concat-stream@^1.5.0, concat-stream@^1.6.0:
typedarray "^0.0.6"
configstore@^3.0.0:
version "3.1.1"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.1.tgz#094ee662ab83fad9917678de114faaea8fcdca90"
version "3.1.2"
resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f"
dependencies:
dot-prop "^4.1.0"
graceful-fs "^4.1.2"
@ -4962,8 +4963,8 @@ global-prefix@^1.0.1:
which "^1.2.14"
globals@^11.0.1, globals@^11.1.0:
version "11.3.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.3.0.tgz#e04fdb7b9796d8adac9c8f64c14837b2313378b0"
version "11.4.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-11.4.0.tgz#b85c793349561c16076a3c13549238a27945f1bc"
globals@^9.17.0, globals@^9.18.0:
version "9.18.0"
@ -5040,25 +5041,25 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.3, graceful-fs@^4.1.4,
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
graphi@5.x.x:
version "5.4.0"
resolved "https://registry.yarnpkg.com/graphi/-/graphi-5.4.0.tgz#b34c67b95f2e3cc1b5b131b475b7fd3991f522e2"
version "5.5.0"
resolved "https://registry.yarnpkg.com/graphi/-/graphi-5.5.0.tgz#6e656b942037121b80e8639afd01230cbcbd67cd"
dependencies:
boom "7.x.x"
graphql "0.13.x"
graphql-server-module-graphiql "1.3.x"
lodash.merge "4.6.x"
graphql-anywhere@^4.1.0-alpha.0, graphql-anywhere@^4.1.7:
version "4.1.7"
resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.1.7.tgz#cbb9106905bcc25bc0e8390548a97f8b154d3f9b"
graphql-anywhere@^4.1.0-alpha.0, graphql-anywhere@^4.1.8:
version "4.1.8"
resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-4.1.8.tgz#23882e6a16ec824febbe5bca40937cdd76c5acdc"
dependencies:
apollo-utilities "^1.0.10"
apollo-utilities "^1.0.11"
graphql-server-module-graphiql@1.3.x:
version "1.3.2"
resolved "https://registry.yarnpkg.com/graphql-server-module-graphiql/-/graphql-server-module-graphiql-1.3.2.tgz#be76bb09e96456962a6d18b6ba1b60450185557f"
version "1.3.3"
resolved "https://registry.yarnpkg.com/graphql-server-module-graphiql/-/graphql-server-module-graphiql-1.3.3.tgz#5d816b1b21084050696967dbd07f08739450f8b1"
dependencies:
apollo-server-module-graphiql "^1.3.2"
apollo-server-module-graphiql "^1.3.3"
graphql-tag@^2.8.0:
version "2.8.0"
@ -5518,8 +5519,8 @@ icss-utils@^2.1.0:
postcss "^6.0.1"
ieee754@^1.1.4:
version "1.1.10"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.10.tgz#719a6f7b026831e64bdb838b0de1bb0029bbf716"
version "1.1.11"
resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.1.11.tgz#c16384ffe00f5b7835824e67b6f2bd44a5229455"
iferr@^0.1.5:
version "0.1.5"
@ -7137,8 +7138,8 @@ markdown-table@^1.1.0:
resolved "https://registry.yarnpkg.com/markdown-table/-/markdown-table-1.1.1.tgz#4b3dd3a133d1518b8ef0dbc709bf2a1b4824bc8c"
markdown-to-jsx@^6.5.2:
version "6.5.2"
resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.5.2.tgz#0a7dbc0524bed5a707d914b61670593a30646f53"
version "6.6.0"
resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.6.0.tgz#311f5b7b3c18cefd066a07800531730d3a62b029"
dependencies:
prop-types "^15.5.10"
unquote "^1.1.0"
@ -8676,7 +8677,7 @@ punycode@1.3.2:
version "1.3.2"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-1.3.2.tgz#9653a036fb7c1ee42342f2325cceefea3926c48d"
punycode@2.x.x:
punycode@2.x.x, punycode@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d"
@ -8816,8 +8817,8 @@ rc@^1.0.1, rc@^1.1.6, rc@^1.1.7:
strip-json-comments "~2.0.1"
react-apollo@^2.0.4:
version "2.1.0"
resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.1.0.tgz#b94c4aca513776d90c368f20a65f99e98fdfea17"
version "2.1.1"
resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-2.1.1.tgz#22a55d28cb54fb652415daf757fb1f743b9daaba"
dependencies:
fbjs "^0.8.16"
hoist-non-react-statics "^2.3.1"
@ -8967,8 +8968,8 @@ react-redux@^5.0.7:
prop-types "^15.6.0"
react-responsive@^4.0.4:
version "4.0.5"
resolved "https://registry.yarnpkg.com/react-responsive/-/react-responsive-4.0.5.tgz#60990c47524d739ba6c44e9351303c34a0409373"
version "4.1.0"
resolved "https://registry.yarnpkg.com/react-responsive/-/react-responsive-4.1.0.tgz#01d129a35729c8f0373e79871cc8d5ecf6e22765"
dependencies:
hyphenate-style-name "^1.0.0"
matchmediaquery "^0.2.1"
@ -11054,13 +11055,14 @@ upath@^1.0.0:
resolved "https://registry.yarnpkg.com/upath/-/upath-1.0.4.tgz#ee2321ba0a786c50973db043a50b7bcba822361d"
update-notifier@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.3.0.tgz#4e8827a6bb915140ab093559d7014e3ebb837451"
version "2.4.0"
resolved "https://registry.yarnpkg.com/update-notifier/-/update-notifier-2.4.0.tgz#f9b4c700fbfd4ec12c811587258777d563d8c866"
dependencies:
boxen "^1.2.1"
chalk "^2.0.1"
configstore "^3.0.0"
import-lazy "^2.1.0"
is-ci "^1.0.10"
is-installed-globally "^0.1.0"
is-npm "^1.0.0"
latest-version "^3.0.0"
@ -11077,6 +11079,12 @@ upper-case@^1.0.3, upper-case@^1.1.1:
version "1.1.3"
resolved "https://registry.yarnpkg.com/upper-case/-/upper-case-1.1.3.tgz#f6b4501c2ec4cdd26ba78be7222961de77621598"
uri-js@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-3.0.2.tgz#f90b858507f81dea4dcfbb3c4c3dbfa2b557faaa"
dependencies:
punycode "^2.1.0"
urijs@^1.16.1:
version "1.19.1"
resolved "https://registry.yarnpkg.com/urijs/-/urijs-1.19.1.tgz#5b0ff530c0cbde8386f6342235ba5ca6e995d25a"