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

@@ -22,7 +22,7 @@ templ ClusterEcShards(data dash.ClusterEcShardsData) {
<i class="fas fa-filter me-1"></i>Collection: {data.FilterCollection}
</span>
}
<a href="/storage/ec-shards" class="btn btn-sm btn-outline-secondary">
<a href={ dash.PUrl(ctx, "/storage/ec-shards") } class="btn btn-sm btn-outline-secondary">
<i class="fas fa-times me-1"></i>Clear Filter
</a>
</div>
@@ -205,11 +205,11 @@ templ ClusterEcShards(data dash.ClusterEcShardsData) {
if data.ShowCollectionColumn {
<td>
if shard.Collection != "" {
<a href="/storage/ec-shards?collection={shard.Collection}" class="text-decoration-none">
<a href={ dash.PUrl(ctx, "/storage/ec-shards?collection=" + shard.Collection) } class="text-decoration-none">
<span class="badge bg-info text-white">{shard.Collection}</span>
</a>
} else {
<a href="/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>
}
@@ -371,7 +371,7 @@ templ ClusterEcShards(data dash.ClusterEcShardsData) {
}
function exportEcShards() {
const url = new URL('/api/storage/ec-shards/export', window.location.origin);
const url = new URL((window.__BASE_PATH__ || '') + '/api/storage/ec-shards/export', window.location.origin);
const params = new URLSearchParams(window.location.search);
params.forEach((value, key) => {
url.searchParams.set(key, value);
@@ -385,7 +385,7 @@ templ ClusterEcShards(data dash.ClusterEcShardsData) {
const volumeId = button.getAttribute('data-volume-id');
// Navigate to the EC volume details page
window.location.href = `/storage/ec-volumes/${volumeId}`;
window.location.href = (window.__BASE_PATH__ || '') + `/storage/ec-volumes/${volumeId}`;
}
function repairVolume(event) {
@@ -393,7 +393,7 @@ templ ClusterEcShards(data dash.ClusterEcShardsData) {
const button = event.target.closest('button');
const volumeId = button.getAttribute('data-volume-id');
showConfirm(`Are you sure you want to repair missing shards for volume ${volumeId}?`, function() {
fetch(`/api/storage/volumes/${volumeId}/repair`, {
fetch((window.__BASE_PATH__ || '') + `/api/storage/volumes/${volumeId}/repair`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',