web: support HTTPS reverse proxy for API calls#3432
Open
LJspice wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the frontend application to dynamically use the current window location protocol (HTTP or HTTPS) instead of hardcoding 'http://' for API requests. It also updates 'formatRestAddr' to omit port '8081' when HTTPS is used. Feedback was provided to ensure that IPv6 address literals are still correctly enclosed in square brackets when the port is omitted under HTTPS, preventing malformed URIs.
d085a1e to
a8210f2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3432 +/- ##
===========================================
- Coverage 55.77% 33.75% -22.02%
===========================================
Files 87 143 +56
Lines 6890 17246 +10356
Branches 0 1413 +1413
===========================================
+ Hits 3843 5822 +1979
- Misses 3047 11117 +8070
- Partials 0 307 +307 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jwhui
reviewed
Jun 23, 2026
This commit updates the Web UI to support being served over HTTPS via a reverse proxy. - Replaces hardcoded 'http://' with 'window.location.protocol' for all REST API calls. - Modifies formatRestAddr() to conditionally omit the '8081' port when the page is accessed via HTTPS, allowing the proxy's port mapping to handle the request. These changes ensure the Web UI remains functional when TLS is terminated at a reverse proxy, while maintaining backward compatibility for standard HTTP deployments.
Per review feedback
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I'm running the web UI behind my existing reverse proxy and authentication middleware, which is configured to properly pass both the web UI and API over HTTPS and port 443. However, the topology tab fails to load due to mixed content errors, as HTTP is hardcoded, as is port 8081 for API calls.
My reference Traefik config, in case these breadcrumbs help someone else in a similar situation:
This commit updates the Web UI to support being served over HTTPS via a reverse proxy.
These changes ensure the Web UI remains functional when TLS is terminated at a reverse proxy, while maintaining backward compatibility for standard HTTP deployments.
Test results:
