fix: replace last hardcoded paths with BASE_PATH-aware alternatives
- index.html: change /src/main.tsx to ./src/main.tsx (relative, respects <base> tag) - AgentRegistrationController: derive SSE endpoint URL from request context via ServletUriComponentsBuilder instead of hardcoding /api/v1 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.slf4j.Logger;
|
||||
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
@@ -136,9 +137,14 @@ public class AgentRegistrationController {
|
||||
String accessToken = jwtService.createAccessToken(request.instanceId(), application, environmentId, roles);
|
||||
String refreshToken = jwtService.createRefreshToken(request.instanceId(), application, environmentId, roles);
|
||||
|
||||
String sseEndpoint = ServletUriComponentsBuilder.fromCurrentContextPath()
|
||||
.path("/api/v1/agents/{id}/events")
|
||||
.buildAndExpand(agent.instanceId())
|
||||
.toUriString();
|
||||
|
||||
return ResponseEntity.ok(new AgentRegistrationResponse(
|
||||
agent.instanceId(),
|
||||
"/api/v1/agents/" + agent.instanceId() + "/events",
|
||||
sseEndpoint,
|
||||
config.getHeartbeatIntervalMs(),
|
||||
ed25519SigningService.getPublicKeyBase64(),
|
||||
accessToken,
|
||||
|
||||
@@ -8,6 +8,6 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.tsx"></script>
|
||||
<script type="module" src="./src/main.tsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user