Fix some errors running behind a proxy.
This commit is contained in:
parent
b3714c90c8
commit
32de1f0ac2
@ -8,12 +8,15 @@ import { InMemoryCache } from 'apollo-cache-inmemory';
|
||||
|
||||
import { createResolvers } from './resolvers';
|
||||
|
||||
const defaultServer = `${window.location.origin}/${window.location.pathname}`
|
||||
const defaultServer = `${window.location.origin}`;
|
||||
|
||||
export const graphqlApi = config => {
|
||||
const { api: { server = defaultServer, path = '/api/graphql' } } = config;
|
||||
|
||||
return `${server}${path}`;
|
||||
const { api: { server = defaultServer, port = '', path = '/api' } } = config;
|
||||
let base = server;
|
||||
if (port) {
|
||||
base = `${base}:${port}`;
|
||||
}
|
||||
return `${base}${path}`;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -3,6 +3,7 @@
|
||||
//
|
||||
|
||||
import React from 'react';
|
||||
import get from 'lodash.get';
|
||||
import Link from '@material-ui/core/Link';
|
||||
|
||||
import { getServiceUrl } from '../util/config';
|
||||
@ -12,11 +13,12 @@ const getAppUrl = (config, { name, version }) => {
|
||||
const pathComponents = [base];
|
||||
|
||||
// TODO(burdon): Fix.
|
||||
// `wire app serve` expects the /wrn/ prefix.
|
||||
// `wire app serve` expects the /app/ prefix.
|
||||
// That is OK in the production config where we can make it part of the the route,
|
||||
// but in development it must be prepended since we don't want to make it part of services.app.server.
|
||||
if (!base.startsWith(`/${config.services.app.prefix}`) && !base.endsWith(`/${config.services.app.prefix}`)) {
|
||||
pathComponents.push(config.services.app.prefix.substring(1));
|
||||
const prefix = get(config, 'services.app.prefix');
|
||||
if (prefix && !base.startsWith(`/${prefix}`) && !base.endsWith(`/${prefix}`)) {
|
||||
pathComponents.push(prefix.substring(1));
|
||||
}
|
||||
|
||||
if (version) {
|
||||
|
Loading…
Reference in New Issue
Block a user