Skip to content

Fix: support Bitbucket Server URL redirects (alias hostnames) - #1935

Open
Laithalrubaie wants to merge 1 commit into
atlassian:mainfrom
Laithalrubaie:fix/bitbucket-server-url-redirect
Open

Fix: support Bitbucket Server URL redirects (alias hostnames)#1935
Laithalrubaie wants to merge 1 commit into
atlassian:mainfrom
Laithalrubaie:fix/bitbucket-server-url-redirect

Conversation

@Laithalrubaie

@Laithalrubaie Laithalrubaie commented Aug 25, 2026

Copy link
Copy Markdown

Summary
Fixes an issue (closes #56 - #802 where git remotes using aliased hostnames that return 301/302 HTTP redirects fail to match configured Bitbucket Server sites, preventing features like the PR panel from loading.

Changes

  • redirectResolver.ts: Added utility to probe unmapped hostnames (HTTPS/HTTP without following redirects) and read the Location header from 3xx responses.
  • BitbucketContext: Integrated the probe during repository refresh for unknown hostnames and added a 1-hour cache for alias → resolved host.
  • siteManager: Updated getSiteForHostname to check the resolved redirect cache as a final fallback.

Testing

  • Unit tests added for redirectResolver, BitbucketContext, and siteManager caching/fallback logic.
  • Verified tsc --noEmit and eslint pass cleanly.
  • Requesting maintainer smoke-testing against an active aliased Bitbucket Server setup.

Key Cuts & Improvements

  • Removed informal filler: Cut conversational idioms ("trippin'", "clutch 🙏", "shoutout") to keep the git log clean and professional.
  • Streamlined context: Removed baseline explanations of why webservers use 301 redirects and internal axios behavior.
  • Standardized layout: Formatted into concise PR sections (Summary, Changes, Testing) for faster maintainer scannability.

Rovo Dev code review: Rovo Dev couldn't review this pull request
The pull request author does not have access to Rovo Dev.

@atlassian-cla-bot

atlassian-cla-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown

Hooray! All contributors have signed the CLA.

@Laithalrubaie
Laithalrubaie force-pushed the fix/bitbucket-server-url-redirect branch 2 times, most recently from f504d70 to 107a87d Compare August 25, 2026 08:28
If a repo's remote uses an old/alias hostname that the webserver
301/302-redirects to the real Bitbucket Server host, the extension
couldn't match it to a configured site (only exact/domain/mirror
hostname matches were tried), so PR features silently didn't work.

Probe unmatched remote hostnames for a redirect, cache the resolved
real host, and let getSiteForHostname fall back to it.
@Laithalrubaie
Laithalrubaie force-pushed the fix/bitbucket-server-url-redirect branch from 107a87d to 50a2bdb Compare August 25, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bitbucket Server] No more local Git repository detection --> no redirection when remote is an alias of true URL

1 participant