Skip to content

Commit f1fddae

Browse files
committed
adding some proxies and pathFilter with langCodeUrl regex
1 parent 0b6f8d8 commit f1fddae

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

packages/react-scripts/proxy/proxies.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,23 @@ const proxies = [
1919
accept:
2020
'application/' /* 'application/x-gedcomx-v1+json', 'application/json', etc. */,
2121
},
22-
{
23-
route: '/ask',
24-
},
2522
{
2623
route: '/cis-web',
2724
},
2825
{
29-
route: '/cmsa',
26+
route: '/cmsa/api',
3027
},
3128
{
3229
route: '/dz',
3330
},
3431
{
35-
route: '/frontier',
32+
route: '/frontier/beacon',
33+
},
34+
{
35+
route: '/frontier/ip',
36+
},
37+
{
38+
route: '/frontier/graphql',
3639
},
3740
{
3841
route: '/hf',

packages/react-scripts/proxy/setupProxy.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,17 @@ const setProxies = (app, customProxies = []) => {
2626
auth('/auth', app)
2727
console.log('\n/auth local proxy set up!')
2828

29+
const langRegex = '^\/[a-z]{2,3}(-[a-zA-Z0-9-]*)?' // Copied from DTM haproxy config MATCH_root_lang_path_with_slash acl
30+
2931
// set default env target
3032
// prod auth keys don't exist in fs-config for security reasons, so only other alt-envs for now
3133
const target = process.env.BASE_URL
3234

3335
const setProxy = proxyConfig => {
36+
const langPathRegex = new RegExp(langRegex + proxyConfig.route)
3437
const options = {
3538
target,
39+
pathFilter: (pathname) => pathname.startsWith(proxyConfig.route) || pathname.match(langPathRegex),
3640
changeOrigin: true,
3741
logLevel: 'debug',
3842
timeout: 5000,

0 commit comments

Comments
 (0)