Skip to content

Commit

Permalink
CCM-5340: try adding allowed origin
Browse files Browse the repository at this point in the history
  • Loading branch information
alexnuttall committed Jan 22, 2025
1 parent 55b1b75 commit cf84de7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
18 changes: 12 additions & 6 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? '/auth';
const domain = process.env.NOTIFY_DOMAIN_NAME ?? 'localhost:3000';

module.exports = {
basePath,

async redirects() {
/*
* Doing redirect rewrites will bypass NextJs' base path
* Without it a redirect('/templates/create-and-submit') would go to /auth/templates/create-and-submit
*/
* Doing redirect rewrites will bypass NextJs' base path
* Without it a redirect('/templates/create-and-submit') would go to /auth/templates/create-and-submit
*/
return [
{
source: `${basePath}/redirect/:path*`,
Expand All @@ -22,7 +22,13 @@ module.exports = {
destination: '/',
basePath: false,
permanent: false,
}
},
];
},
}

experimental: {
serverActions: {
allowedOrigins: [domain, domain.replace('iam', 'web-gateway')],
},
},
};
5 changes: 5 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export function middleware(request: NextRequest) {

requestHeaders.set('Content-Security-Policy', csp);

// requestHeaders.set(
// 'x-forwarded-host',
// requestHeaders.get('origin')?.replace('https://', '') || '*'
// );

const response = NextResponse.next({
request: {
headers: requestHeaders,
Expand Down

0 comments on commit cf84de7

Please sign in to comment.