Skip to content

Commit d2d7032

Browse files
authored
Merge pull request #2013 from navikt/dev-xp-rewrite-fix
Dev xp rewrite fix
2 parents 589555d + 459a3ed commit d2d7032

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

next.config.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ const config = {
213213
destination: `${process.env.APP_ORIGIN}/no/nav-og-samfunn/samarbeid/for-kommunen/digisos/til-kommuner-som-onsker-a-ta-i-bruk-digital-soknad-om-okonomisk-sosialhjelp/Håndbok for innføring av digital søknad %2800B%29 12.12.19.pdf`,
214214
permanent: false,
215215
},
216+
// /_/* should point to XP services. Redirect only if XP is on a different origin
217+
...(process.env.XP_ORIGIN !== process.env.APP_ORIGIN
218+
? [
219+
{
220+
source: '/_/:path*',
221+
destination: `${process.env.XP_ORIGIN}/_/:path*`,
222+
permanent: false,
223+
},
224+
]
225+
: []),
216226
],
217227
rewrites: async () => [
218228
{
@@ -249,15 +259,6 @@ const config = {
249259
source: '/feilside',
250260
destination: '/404',
251261
},
252-
// /_/* should point to XP services. Rewrite only if XP is on a different origin
253-
...(process.env.XP_ORIGIN !== process.env.APP_ORIGIN
254-
? [
255-
{
256-
source: '/_/:path*',
257-
destination: `${process.env.XP_ORIGIN}/_/:path*`,
258-
},
259-
]
260-
: []),
261262
...(isLocal
262263
? [
263264
{

server/src/server-setup/server-setup-dev.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const serverSetupDev = (expressApp: Express, nextApp: NextServer) => {
1616
// These paths should never redirect, to ensure the site will load correctly
1717
// when accessed from the Content Studio editor
1818
expressApp.all(
19-
['/draft/*', '/archive/*', '/editor/*', '/_next/*', '/gfx/*', '/api/*'],
19+
['/draft/*', '/archive/*', '/editor/*', '/_next/*', '/gfx/*', '/api/*', '/_/*'],
2020
(req, res) => {
2121
return nextRequestHandler(req, res);
2222
}

0 commit comments

Comments
 (0)