[PR #139] [MERGED] Adds support for path prefix configuration #160

Closed
opened 2026-02-26 21:34:46 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/eduardolat/pgbackweb/pull/139
Author: @PatrikScully
Created: 10/3/2025
Status: Merged
Merged: 10/5/2025
Merged by: @eduardolat

Base: developHead: feature/path-prefix


📝 Commits (6)

  • 2e0447d Adds support for path prefix configuration
  • e91d202 Refactors pathutil test suite for better isolation
  • 6965e14 Supports subdirectory deployment with configurable path prefix
  • 7658e21 Refactors URL paths using pathutil.BuildPath function
  • 7b81f8a Standardizes URL path formatting in dashboard components
  • f39598d Refactors URL handling with pathutil.BuildPath

📊 Changes

54 files changed (+473 additions, -92 deletions)

View changed files

📝 README.md (+5 -0)
📝 cmd/app/main.go (+5 -1)
📝 internal/config/env.go (+1 -0)
📝 internal/config/env_validate.go (+4 -0)
internal/util/pathutil/pathutil.go (+35 -0)
internal/util/pathutil/pathutil_test.go (+87 -0)
internal/validate/path_prefix.go (+43 -0)
internal/validate/path_prefix_test.go (+78 -0)
📝 internal/view/middleware/require_auth.go (+7 -4)
📝 internal/view/middleware/require_no_auth.go (+4 -2)
📝 internal/view/router.go (+18 -4)
📝 internal/view/static/static_fs.go (+9 -1)
📝 internal/view/web/auth/create_first_user.go (+4 -3)
📝 internal/view/web/auth/login.go (+4 -3)
📝 internal/view/web/auth/logout.go (+3 -2)
📝 internal/view/web/component/logotype.go (+2 -1)
📝 internal/view/web/component/support_project.inc.js (+43 -2)
📝 internal/view/web/dashboard/backups/create_backup.go (+4 -3)
📝 internal/view/web/dashboard/backups/delete_backup.go (+4 -1)
📝 internal/view/web/dashboard/backups/duplicate_backup.go (+4 -1)

...and 34 more files

📄 Description

Introduces configurable path prefix to serve application under subpath (e.g., /pgbackweb) Implements validation for path prefixes in environment variables Updates all redirects and routes to use the configured path prefix

This allows deploying the app at a custom URL path while maintaining correct functionality.

Summary by CodeRabbit

  • New Features

    • App can be served under a configurable path prefix; routes, redirects, links, and static assets now respect the prefix while unset prefix preserves prior behavior.
  • Documentation

    • Added PBW_PATH_PREFIX to README and Docker Compose example (must start with "/", must not end with "/", empty allowed).
  • Tests

    • Added unit tests for path-prefix validation and path-building.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/eduardolat/pgbackweb/pull/139 **Author:** [@PatrikScully](https://github.com/PatrikScully) **Created:** 10/3/2025 **Status:** ✅ Merged **Merged:** 10/5/2025 **Merged by:** [@eduardolat](https://github.com/eduardolat) **Base:** `develop` ← **Head:** `feature/path-prefix` --- ### 📝 Commits (6) - [`2e0447d`](https://github.com/eduardolat/pgbackweb/commit/2e0447d500018888779db7d9545569f6ee9a66ea) Adds support for path prefix configuration - [`e91d202`](https://github.com/eduardolat/pgbackweb/commit/e91d2026e655191e046c0466dfda470d9bc8d143) Refactors pathutil test suite for better isolation - [`6965e14`](https://github.com/eduardolat/pgbackweb/commit/6965e14a41647f34cab66c6c4f0e51e5839eb1c9) Supports subdirectory deployment with configurable path prefix - [`7658e21`](https://github.com/eduardolat/pgbackweb/commit/7658e21aaa147f65cad18ea1ab821efcc18291f7) Refactors URL paths using pathutil.BuildPath function - [`7b81f8a`](https://github.com/eduardolat/pgbackweb/commit/7b81f8add1d0812d34c5494a48374f951afc2719) Standardizes URL path formatting in dashboard components - [`f39598d`](https://github.com/eduardolat/pgbackweb/commit/f39598db9749de150c1d90c57faefb4580767107) Refactors URL handling with pathutil.BuildPath ### 📊 Changes **54 files changed** (+473 additions, -92 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+5 -0) 📝 `cmd/app/main.go` (+5 -1) 📝 `internal/config/env.go` (+1 -0) 📝 `internal/config/env_validate.go` (+4 -0) ➕ `internal/util/pathutil/pathutil.go` (+35 -0) ➕ `internal/util/pathutil/pathutil_test.go` (+87 -0) ➕ `internal/validate/path_prefix.go` (+43 -0) ➕ `internal/validate/path_prefix_test.go` (+78 -0) 📝 `internal/view/middleware/require_auth.go` (+7 -4) 📝 `internal/view/middleware/require_no_auth.go` (+4 -2) 📝 `internal/view/router.go` (+18 -4) 📝 `internal/view/static/static_fs.go` (+9 -1) 📝 `internal/view/web/auth/create_first_user.go` (+4 -3) 📝 `internal/view/web/auth/login.go` (+4 -3) 📝 `internal/view/web/auth/logout.go` (+3 -2) 📝 `internal/view/web/component/logotype.go` (+2 -1) 📝 `internal/view/web/component/support_project.inc.js` (+43 -2) 📝 `internal/view/web/dashboard/backups/create_backup.go` (+4 -3) 📝 `internal/view/web/dashboard/backups/delete_backup.go` (+4 -1) 📝 `internal/view/web/dashboard/backups/duplicate_backup.go` (+4 -1) _...and 34 more files_ </details> ### 📄 Description Introduces configurable path prefix to serve application under subpath (e.g., /pgbackweb) Implements validation for path prefixes in environment variables Updates all redirects and routes to use the configured path prefix This allows deploying the app at a custom URL path while maintaining correct functionality. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - App can be served under a configurable path prefix; routes, redirects, links, and static assets now respect the prefix while unset prefix preserves prior behavior. - **Documentation** - Added PBW_PATH_PREFIX to README and Docker Compose example (must start with "/", must not end with "/", empty allowed). - **Tests** - Added unit tests for path-prefix validation and path-building. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 21:34:46 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/pgbackweb#160
No description provided.