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 S3TablesNamespaces(data dash.S3TablesNamespacesData) {
</div>
</div>
<div class="mb-3">
<a href="/object-store/s3tables/buckets" class="btn btn-sm btn-outline-secondary">
<a href={ dash.PUrl(ctx, "/object-store/s3tables/buckets") } class="btn btn-sm btn-outline-secondary">
<i class="fas fa-arrow-left me-1"></i>Back to Buckets
</a>
<span class="text-muted ms-2">Bucket ARN: { data.BucketARN }</span>
@@ -107,7 +107,7 @@ templ S3TablesNamespaces(data dash.S3TablesNamespacesData) {
<td>
<div class="btn-group btn-group-sm" role="group">
if parseErr == nil {
<a class="btn btn-outline-primary btn-sm" href={ templ.SafeURL(fmt.Sprintf("/object-store/s3tables/buckets/%s/namespaces/%s/tables", bucketName, namespaceName)) }>
<a class="btn btn-outline-primary btn-sm" href={ dash.PUrl(ctx, fmt.Sprintf("/object-store/s3tables/buckets/%s/namespaces/%s/tables", bucketName, namespaceName)) }>
<i class="fas fa-table"></i>
</a>
} else {
@@ -311,7 +311,7 @@ templ S3TablesNamespaces(data dash.S3TablesNamespacesData) {
return;
}
try {
const response = await fetch('/api/s3tables/namespaces', {
const response = await fetch((window.__BASE_PATH__ || '') + '/api/s3tables/namespaces', {
method: 'POST',
headers: makeJSONHeaders(),
body: JSON.stringify({ bucket_arn: dataBucketArn, name: name })
@@ -338,7 +338,7 @@ templ S3TablesNamespaces(data dash.S3TablesNamespacesData) {
if (csrfToken) {
requestOptions.headers = { 'X-CSRF-Token': csrfToken };
}
const response = await fetch(`/api/s3tables/namespaces?bucket=${encodeURIComponent(dataBucketArn)}&name=${encodeURIComponent(namespace)}`, requestOptions);
const response = await fetch((window.__BASE_PATH__ || '') + `/api/s3tables/namespaces?bucket=${encodeURIComponent(dataBucketArn)}&name=${encodeURIComponent(namespace)}`, requestOptions);
if (!response.ok) {
const errorMessage = await readErrorMessage(response, 'Failed to delete namespace');
alert(errorMessage);