Skip to content

Commit

Permalink
Update require and function name
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyEJohnson committed Oct 24, 2024
1 parent 9bd63e9 commit 2baea83
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
const url = require('url');
const fs = require('fs');
const path = require('path');
const proxy = require('http-proxy-middleware');
const {createProxyMiddleware} = require('http-proxy-middleware');
const {
SKIP_OS_WEB_PROXY,
FIXTURES,
Expand Down Expand Up @@ -130,15 +130,15 @@ function setupTestProxy(app) {
}

function archiveProxy(app) {
archivePaths.forEach(path => app.use(proxy(path, {
archivePaths.forEach(path => app.use(createProxyMiddleware(path, {
target: `${ARCHIVE_URL}${path}`,
prependPath: false,
changeOrigin: true,
})));
}

function accountsProxy(app) {
app.use(proxy(REACT_APP_ACCOUNTS_URL, {
app.use(createProxyMiddleware(REACT_APP_ACCOUNTS_URL, {
target: ACCOUNTS_URL,
changeOrigin: true,
autoRewrite: true,
Expand All @@ -153,38 +153,38 @@ function accountsProxy(app) {
}

function imageCdnProxy(app) {
app.use(proxy(REACT_APP_IMAGE_CDN_URL, {
app.use(createProxyMiddleware(REACT_APP_IMAGE_CDN_URL, {
target: IMAGE_CDN_URL,
changeOrigin: true,
autoRewrite: true,
}));
}

function searchProxy(app) {
app.use(proxy(REACT_APP_SEARCH_URL, {
app.use(createProxyMiddleware(REACT_APP_SEARCH_URL, {
target: SEARCH_URL,
changeOrigin: true,
autoRewrite: true,
}));
}

function highlightsProxy(app) {
app.use(proxy(REACT_APP_HIGHLIGHTS_URL, {
app.use(createProxyMiddleware(REACT_APP_HIGHLIGHTS_URL, {
target: HIGHLIGHTS_URL,
changeOrigin: true,
autoRewrite: true,
}));
}

function osWebApiProxy(app) {
app.use(proxy(REACT_APP_OS_WEB_API_URL, {
app.use(createProxyMiddleware(REACT_APP_OS_WEB_API_URL, {
target: OS_WEB_URL,
changeOrigin: true,
}));
}

function osWebProxy(app) {
app.use(proxy((path) => !path.match(/^\/((books\/.*)|(apps\/rex\/.*)|static.*|errors.*|rex.*|asset-manifest.json|precache-manifest.*|index.html|\/)?$/) , {
app.use(createProxyMiddleware((path) => !path.match(/^\/((books\/.*)|(apps\/rex\/.*)|static.*|errors.*|rex.*|asset-manifest.json|precache-manifest.*|index.html|\/)?$/) , {
target: OS_WEB_URL,
changeOrigin: true,
}));
Expand Down

0 comments on commit 2baea83

Please sign in to comment.