-
-
Notifications
You must be signed in to change notification settings - Fork 18
fix token interceptor for https #1524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
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 treathttps://URLs as already-normalized (same ashttp://). - Update
environment.dev.tsto pointapiRoot/saasURLtohttps://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.
| if (url.startsWith('http://')) { | ||
| return url; | ||
| } | ||
| if (url.startsWith('https://')) { | ||
| return url; | ||
| } |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
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).
| if (url.startsWith('http://')) { | ||
| return url; | ||
| } | ||
| if (url.startsWith('https://')) { | ||
| return url; | ||
| } |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
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.
| if (url.startsWith('http://')) { | |
| return url; | |
| } | |
| if (url.startsWith('https://')) { | |
| return url; | |
| } | |
| if (url.startsWith('http://') || url.startsWith('https://')) { | |
| return url; | |
| } |
| apiRoot: 'https://app.rocketadmin.com/api', | ||
| saasURL: 'https://app.rocketadmin.com', |
Copilot
AI
Jan 22, 2026
There was a problem hiding this comment.
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.
No description provided.