diff --git a/src/main/java/am/ik/blog/admin/web/AdminController.java b/src/main/java/am/ik/blog/admin/web/AdminController.java index c1c0a69..b7efd90 100644 --- a/src/main/java/am/ik/blog/admin/web/AdminController.java +++ b/src/main/java/am/ik/blog/admin/web/AdminController.java @@ -54,11 +54,10 @@ public ResponseEntity login(@RequestParam(name = "redirect_path") String r } UriComponents uriComponents = uriComponentsBuilder.path(redirectPath).build(); String location; - if (referer.getPort() == VITE_DEV_PORT) { + int port = referer.getPort(); + if (isViteDevPort(port)) { // behind the vite proxy in the dev-mode - location = UriComponentsBuilder.fromUriString(uriComponents.toUriString()) - .port(referer.getPort()) - .toUriString(); + location = UriComponentsBuilder.fromUriString(uriComponents.toUriString()).port(port).toUriString(); } else { location = uriComponents.toUriString(); @@ -91,4 +90,8 @@ public void deleteComment(@PathVariable Long commentId) { public record CommentUpdateRequest(Comment.Status status) { } + static boolean isViteDevPort(int port) { + return port >= 5170 && port <= 5179; + } + }