@zengenti/contensis-react-base 3.0.1-beta.2 → 3.0.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,7 +14,7 @@ require('query-string');
14
14
  require('immer');
15
15
  require('deep-equal');
16
16
  var contensisCoreApi = require('contensis-core-api');
17
- var setCachingHeaders = require('./setCachingHeaders-ee619bdf.js');
17
+ var urls = require('./urls-6fcaf4c6.js');
18
18
  require('isomorphic-fetch');
19
19
  var express = require('express');
20
20
  var httpProxy = require('http-proxy');
@@ -638,7 +638,7 @@ const makeLinkDepthMiddleware = ({
638
638
  const linkDepthMiddleware = async (req, res) => {
639
639
  try {
640
640
  // Short cache duration copied from canterbury project
641
- setCachingHeaders.setCachingHeaders(res, {
641
+ urls.setCachingHeaders(res, {
642
642
  cacheControl: 'private',
643
643
  surrogateControl: '10'
644
644
  }); // Gather all params from the request, we will use them at the right query levels later
@@ -700,6 +700,13 @@ const DisplayStartupConfiguration = config => {
700
700
  const servers = SERVERS;
701
701
  /* global SERVERS */
702
702
 
703
+ const project = PROJECT;
704
+ /* global PROJECT */
705
+
706
+ const alias = ALIAS;
707
+ /* global ALIAS */
708
+
709
+ const deliveryApiHostname = urls.url(alias, project).api;
703
710
  const apiProxy = httpProxy__default["default"].createProxyServer();
704
711
 
705
712
  const reverseProxies = (app, reverseProxyPaths = []) => {
@@ -722,10 +729,9 @@ const deliveryApiProxy = (apiProxy, app) => {
722
729
  // This is just here to stop cors requests on localhost. In Production this is mapped using varnish.
723
730
  app.all(['/api/delivery/*', '/api/image/*'], (req, res) => {
724
731
  /* eslint-disable no-console */
725
- const target = servers.cms;
726
732
  console.log(`Proxying api request to ${servers.alias}`);
727
733
  apiProxy.web(req, res, {
728
- target,
734
+ target: deliveryApiHostname,
729
735
  changeOrigin: true
730
736
  });
731
737
  apiProxy.on('error', e => {