[PR #1580] [MERGED] Rules for rewriting requests to another path #1123

Closed
opened 2025-11-13 12:18:43 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/pangolin/pull/1580
Author: @Pallavikumarimdb
Created: 9/28/2025
Status: Merged
Merged: 10/4/2025
Merged by: @oschwartz10612

Base: devHead: feature/path-rewriting-rules


📝 Commits (10+)

  • 149a4b9 basic setup for rewriting requests to another path
  • 90d3ac0 add rewrite path to create resource page
  • 218a5ec fix traefik config file
  • 3722b67 preserves the rest of the path after the matched prefix
  • a97b6ef redesign path match and rewrite modal
  • 7b2f1dd button fix
  • 1b34ee7 match and rewrite path ui improve for create resource
  • 574cd2a make rewrite data null if no match added
  • 664aa6e update blueprints
  • 51fad19 Sanitize all keys

📊 Changes

12 files changed (+1004 additions, -292 deletions)

View changed files

📝 messages/en-US.json (+4 -2)
📝 server/db/pg/schema.ts (+3 -1)
📝 server/db/sqlite/schema.ts (+3 -1)
📝 server/lib/blueprints/proxyResources.ts (+6 -2)
📝 server/lib/blueprints/types.ts (+4 -2)
📝 server/routers/target/createTarget.ts (+3 -1)
📝 server/routers/target/listTargets.ts (+3 -1)
📝 server/routers/target/updateTarget.ts (+3 -1)
📝 server/routers/traefik/getTraefikConfig.ts (+319 -48)
📝 src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx (+219 -154)
📝 src/app/[orgId]/settings/resources/create/page.tsx (+144 -79)
src/components/PathMatchRenameModal.tsx (+293 -0)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

This PR introduces support for path rewriting rules.

  • Middleware creation for different rewrite strategies (exact, prefix, regex, stripPrefix).
  • Extended config generation to include path rewrite middlewares in router chains.
  • Ensures invalid rewrite configurations are logged and skipped.

This makes it possible to rewrite incoming request paths before forwarding to targets.
image

image

How to test?


🔄 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/fosrl/pangolin/pull/1580 **Author:** [@Pallavikumarimdb](https://github.com/Pallavikumarimdb) **Created:** 9/28/2025 **Status:** ✅ Merged **Merged:** 10/4/2025 **Merged by:** [@oschwartz10612](https://github.com/oschwartz10612) **Base:** `dev` ← **Head:** `feature/path-rewriting-rules` --- ### 📝 Commits (10+) - [`149a4b9`](https://github.com/fosrl/pangolin/commit/149a4b916b37ff0eb1f5fa496a9f6dccdb2cddcf) basic setup for rewriting requests to another path - [`90d3ac0`](https://github.com/fosrl/pangolin/commit/90d3ac07a9f1c490746a8fe72a97b1de1ddbbee9) add rewrite path to create resource page - [`218a5ec`](https://github.com/fosrl/pangolin/commit/218a5ec9e4f5bf2802b0d0625d498582ec76ec24) fix traefik config file - [`3722b67`](https://github.com/fosrl/pangolin/commit/3722b6772433a9ff597f1fe2df3c060eb6d23efb) preserves the rest of the path after the matched prefix - [`a97b6ef`](https://github.com/fosrl/pangolin/commit/a97b6efe9cc2b6d6095b76929902932692574c8e) redesign path match and rewrite modal - [`7b2f1dd`](https://github.com/fosrl/pangolin/commit/7b2f1dd4c654b9fed12bbcdbfc33398c319989ed) button fix - [`1b34ee7`](https://github.com/fosrl/pangolin/commit/1b34ee7369545ccd58f2f54ada298fb512e182c5) match and rewrite path ui improve for create resource - [`574cd2a`](https://github.com/fosrl/pangolin/commit/574cd2a754d524bf1023e051ab380093565870b7) make rewrite data null if no match added - [`664aa6e`](https://github.com/fosrl/pangolin/commit/664aa6ed2a83f174a337f30cc1544d381614b076) update blueprints - [`51fad19`](https://github.com/fosrl/pangolin/commit/51fad19d0ded1561c338cc1f08b5d53743157249) Sanitize all keys ### 📊 Changes **12 files changed** (+1004 additions, -292 deletions) <details> <summary>View changed files</summary> 📝 `messages/en-US.json` (+4 -2) 📝 `server/db/pg/schema.ts` (+3 -1) 📝 `server/db/sqlite/schema.ts` (+3 -1) 📝 `server/lib/blueprints/proxyResources.ts` (+6 -2) 📝 `server/lib/blueprints/types.ts` (+4 -2) 📝 `server/routers/target/createTarget.ts` (+3 -1) 📝 `server/routers/target/listTargets.ts` (+3 -1) 📝 `server/routers/target/updateTarget.ts` (+3 -1) 📝 `server/routers/traefik/getTraefikConfig.ts` (+319 -48) 📝 `src/app/[orgId]/settings/resources/[niceId]/proxy/page.tsx` (+219 -154) 📝 `src/app/[orgId]/settings/resources/create/page.tsx` (+144 -79) ➕ `src/components/PathMatchRenameModal.tsx` (+293 -0) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description **This PR introduces support for path rewriting rules.** - Middleware creation for different rewrite strategies (exact, prefix, regex, stripPrefix). - Extended config generation to include path rewrite middlewares in router chains. - Ensures invalid rewrite configurations are logged and skipped. This makes it possible to rewrite incoming request paths before forwarding to targets. <img width="2578" height="794" alt="image" src="https://github.com/user-attachments/assets/65fcffa9-9048-4569-b14e-bddd49744a7d" /> <img width="1166" height="864" alt="image" src="https://github.com/user-attachments/assets/f9df4873-2c8f-4d32-9ef1-346bedf23cc0" /> ## How to test? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-13 12:18:43 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#1123