-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#139 | Use reverse proxy in local-staging mode for development
- Loading branch information
1 parent
75192e5
commit f00a69b
Showing
6 changed files
with
1,947 additions
and
1,292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
NEXT_PUBLIC_IMAGE_LIST_URL=/etl/media | ||
NEXT_PUBLIC_DOWNLOAD_REQUEST_URL=/media-viewer/requestDownload | ||
NEXT_PUBLIC_DOWNLOAD_LIST_URL=/media-viewer/allData | ||
NEXT_PUBLIC_OPERATIONAL_MODULE=/web/operationalModules | ||
NEXT_PUBLIC_FORMS=/web/form/ | ||
NEXT_PUBLIC_TOP_ADDRESS=/locations/search/find | ||
NEXT_PUBLIC_WEBAPP_BASE_URL=http://localhost:6010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const mediaViewerService = "http://localhost:8023/media-viewer"; | ||
const etlService = "http://localhost:8022/"; | ||
const mainService = "http://localhost:8021/"; | ||
|
||
import {NextResponse} from 'next/server' | ||
|
||
// console.log("Middleware used"); | ||
|
||
export function middleware(request) { | ||
const pathname = request.nextUrl.pathname; | ||
// console.log("Path:", pathname); | ||
|
||
if (pathname.startsWith('/web') || pathname.startsWith("/location")) { | ||
const url = new URL(pathname, mainService); | ||
// console.log("Rewriting to ", JSON.stringify(url)); | ||
return NextResponse.rewrite(url); | ||
} | ||
if (pathname.startsWith('/etl')) { | ||
// console.log(request.nextUrl); | ||
const url = new URL(pathname.replace("/etl", "")+request.nextUrl.search, etlService); | ||
// console.log("Rewriting to ", JSON.stringify(url)); | ||
return NextResponse.rewrite(url); | ||
} | ||
if (pathname.startsWith('/media-viewer')) { | ||
return NextResponse.rewrite(new URL(pathname, mediaViewerService)) | ||
} | ||
} |
Oops, something went wrong.