Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reload webpages when refreshed #1021

Merged
merged 1 commit into from
Aug 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -872,19 +872,11 @@ protected HttpResponse doGet(ServiceRequestContext ctx, HttpRequest req) {
sb.service(LOGOUT_PATH, authProvider.webLogoutService());
}

// Folder names contain path patterns such as `[projectName]` which FileService can't infer from
// the request path. Return `index.html` as a fallback so that Next.js client router handles the
// path patterns.
final HttpService fallbackFileService = HttpFile.of(CentralDogma.class.getClassLoader(),
"com/linecorp/centraldogma/webapp/index.html")
.asService();
sb.serviceUnder("/app", FileService.builder(CentralDogma.class.getClassLoader(),
"com/linecorp/centraldogma/webapp/app")
.cacheControl(ServerCacheControl.REVALIDATED)
.autoDecompress(true)
.serveCompressedFiles(true)
.build().orElse(fallbackFileService));

// If the index.html is just returned, Next.js will handle the all remaining process such as
// fetching resources and routes to the target pages.
sb.serviceUnder("/app", HttpFile.of(CentralDogma.class.getClassLoader(),
"com/linecorp/centraldogma/webapp/index.html")
.asService());
// Serve all web resources except for '/app'.
sb.route()
.pathPrefix("/")
Expand Down
Loading