feat(admin): add -urlPrefix flag for subdirectory deployment (#8670)

Allow the admin server to run behind a reverse proxy under a
subdirectory by adding a -urlPrefix flag (e.g. -urlPrefix=/seaweedfs).

Closes #8646
This commit is contained in:
Chris Lu
2026-03-16 15:26:02 -07:00
committed by GitHub
parent 9984ce7dcb
commit e8914ac879
60 changed files with 5013 additions and 4012 deletions

View File

@@ -25,7 +25,7 @@ templ ClusterEcVolumes(data dash.ClusterEcVolumesData) {
<i class="fas fa-filter me-1"></i>Collection: {data.Collection}
</span>
}
<a href="/storage/ec-volumes" class="btn btn-sm btn-outline-secondary">
<a href={ dash.PUrl(ctx, "/storage/ec-volumes") } class="btn btn-sm btn-outline-secondary">
<i class="fas fa-times me-1"></i>Clear Filter
</a>
</div>
@@ -201,11 +201,11 @@ templ ClusterEcVolumes(data dash.ClusterEcVolumesData) {
if data.ShowCollectionColumn {
<td>
if volume.Collection != "" {
<a href={ templ.URL(fmt.Sprintf("/storage/ec-shards?collection=%s", volume.Collection)) } class="text-decoration-none">
<a href={ dash.PUrl(ctx, fmt.Sprintf("/storage/ec-shards?collection=%s", volume.Collection)) } class="text-decoration-none">
<span class="badge bg-info text-white">{volume.Collection}</span>
</a>
} else {
<a href={ templ.URL("/storage/ec-shards?collection=default") } class="text-decoration-none">
<a href={ dash.PUrl(ctx, "/storage/ec-shards?collection=default") } class="text-decoration-none">
<span class="badge bg-secondary text-white">default</span>
</a>
}
@@ -373,13 +373,13 @@ templ ClusterEcVolumes(data dash.ClusterEcVolumesData) {
function showVolumeDetails(event) {
const volumeId = event.target.closest('button').getAttribute('data-volume-id');
window.location.href = `/storage/ec-volumes/${volumeId}`;
window.location.href = (window.__BASE_PATH__ || '') + `/storage/ec-volumes/${volumeId}`;
}
function repairVolume(event) {
const volumeId = event.target.closest('button').getAttribute('data-volume-id');
showConfirm(`Are you sure you want to repair missing shards for volume ${volumeId}?`, function() {
fetch(`/api/storage/ec-volumes/${volumeId}/repair`, {
fetch((window.__BASE_PATH__ || '') + `/api/storage/ec-volumes/${volumeId}/repair`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',