Skip to content

fix token interceptor for https#1524

Merged
lyubov-voloshko merged 2 commits into
mainfrom
fix-interceptor
Jan 22, 2026
Merged

fix token interceptor for https#1524
lyubov-voloshko merged 2 commits into
mainfrom
fix-interceptor

Conversation

@lyubov-voloshko

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings January 22, 2026 15:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates frontend URL handling so the token interceptor doesn’t incorrectly rewrite absolute HTTPS URLs, and adjusts development environment endpoints.

Changes:

  • Extend TokenInterceptor.normalizeURL() to treat https:// URLs as already-normalized (same as http://).
  • Update environment.dev.ts to point apiRoot/saasURL to https://app.rocketadmin.com.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
frontend/src/environments/environment.dev.ts Switches “development” build endpoints to app.rocketadmin.com.
frontend/src/app/services/token.interceptor.ts Prevents base URL prefixing when request URLs are absolute HTTPS.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 34 to +39
if (url.startsWith('http://')) {
return url;
}
if (url.startsWith('https://')) {
return url;
}

Copilot AI Jan 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new https:// branch changes URL normalization behavior but the existing spec only checks interceptor creation. Please add unit tests that exercise normalizeURL() for http:// and https:// absolute URLs to ensure they are not prefixed with baseURL (and to guard against regressions).

Copilot uses AI. Check for mistakes.
Comment on lines 34 to +39
if (url.startsWith('http://')) {
return url;
}
if (url.startsWith('https://')) {
return url;
}

Copilot AI Jan 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The http:// and https:// checks are duplicated branches. Consider collapsing them into a single protocol check (e.g., https?://) to reduce the chance of future divergence and keep the normalization logic easier to maintain.

Suggested change
if (url.startsWith('http://')) {
return url;
}
if (url.startsWith('https://')) {
return url;
}
if (url.startsWith('http://') || url.startsWith('https://')) {
return url;
}

Copilot uses AI. Check for mistakes.
Comment on lines +4 to +5
apiRoot: 'https://app.rocketadmin.com/api',
saasURL: 'https://app.rocketadmin.com',

Copilot AI Jan 22, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

environment.dev.ts now points apiRoot/saasURL at the production host (app.rocketadmin.com). Since this file is used by the Angular build:development configuration (see frontend/angular.json), this will make “development” builds talk to production, which is risky and can also bypass the local /api proxy setup. If the goal is only to fix https URL handling, consider reverting these URLs back to the dev/staging host (or using relative /api + proxy) and introducing a separate environment file/config for production endpoints if needed.

Copilot uses AI. Check for mistakes.
@lyubov-voloshko lyubov-voloshko merged commit 2df5d3f into main Jan 22, 2026
17 checks passed
@lyubov-voloshko lyubov-voloshko deleted the fix-interceptor branch January 22, 2026 16:00
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.

2 participants