Fix to issues with binding to ports other than 80/443 for web resources #1148

Closed
opened 2026-04-05 18:21:29 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @Error-Gap on 7/31/2025

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

Fix to issues with binding to ports other than 80/443 for HTTP/HTTPS web resources

  • server/routers/badger/verifySession.ts : verifyResourceSession() updated code behind "cleanHost" var to a regex which strips the trailing :port for any port (rather than a string match for 80/443)
  • src/app/auth/resource/[resourceId]/page.tsx : ResourceAuthPage() added a secondary match for serverResourceHost and redirectHost that accounts for ports
  • server/routers/badger/exchangeSession.ts : Updated exchangeSession() to use the same "cleanHost" type var (with port-stripping) as in verifyResourceSession(), replaced references to "host" with "cleanHost"

How to test?

When running from docker, bind the ports in docker-compose with something other than 443:443 and 80:80
(in my case I also changed the "entrypoints" ports for traefik but this may not be necessary)

*Originally created by @Error-Gap on 7/31/2025* ## 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 Fix to issues with binding to ports other than 80/443 for HTTP/HTTPS web resources - server/routers/badger/verifySession.ts : verifyResourceSession() updated code behind "cleanHost" var to a regex which strips the trailing :port for any port (rather than a string match for 80/443) - src/app/auth/resource/[resourceId]/page.tsx : ResourceAuthPage() added a secondary match for serverResourceHost and redirectHost that accounts for ports - server/routers/badger/exchangeSession.ts : Updated exchangeSession() to use the same "cleanHost" type var (with port-stripping) as in verifyResourceSession(), replaced references to "host" with "cleanHost" ## How to test? When running from docker, bind the ports in docker-compose with something other than 443:443 and 80:80 (in my case I also changed the "entrypoints" ports for traefik but this may not be necessary)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#1148