-
-
Notifications
You must be signed in to change notification settings - Fork 327
internal reverse proxy from 20212 to 20211/server #1450
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
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughConfigures a new reverse-proxy endpoint at Changes
Sequence DiagramsequenceDiagram
participant Client
participant Nginx as nginx<br/>(/server/)
participant Backend as Backend Service<br/>(:20212)
Client->>Nginx: GET /server/api/endpoint
Nginx->>Nginx: Validate HTTP method
Nginx->>Backend: Forward request with headers<br/>(Host, X-Real-IP, Authorization,<br/>X-Forwarded-Prefix: /server)
Backend->>Backend: Process request
Backend->>Nginx: Response
Nginx->>Nginx: Normalize redirect<br/>to /server/
Nginx->>Client: Response with<br/>X-Powered-By hidden
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@server/api_server/openapi/swagger.html`:
- Around line 18-21: The Swagger UI is using a relative spec URL causing 404s
when swagger.html is served under a subpath; update the SwaggerUIBundle
configuration so the url property points to the absolute backend spec path (e.g.
"/openapi.json") or compute the absolute path from the page base (using
window.location.origin + '/openapi.json' or reading a <base> tag) inside the
swagger.html initialization (the object passed to SwaggerUIBundle where url:
'openapi.json' is currently set) so the UI always requests the spec from the
correct absolute endpoint.
|
@adamoutler Is BACKEND_API_URL actually needed after this change? If it is set internally to REPORT_DASHBOARD_URL/server I guess it's not needed anymore. |
That could be a future improvement. |
|
#1452 will track the Change needed to |
|
this is kinda a standalone change just exposing the port 20212 on flowchart LR
client[Client] -->|Direct| p20211[(Server :20211)]
client -->|Direct| p20212[(Server :20212)]
p20212 -->|Reverse proxy| rp[Proxy rules]
rp -->|/server -> :20211/server| p20211
svc20211[20212 Service on :20211<br> path /server]
p20211 --> svc20211
|
| deny all; | ||
| } | ||
|
|
||
| proxy_pass http://127.0.0.1:20212/; |
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.
Doesn't this have to be dynamic if someone changes the default PORT?
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.
No. With this system we can eventually stop exposing the port. This will be a fixed port only available to 127.0.0.1 as far as I know. There is no external access.
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.
Users will configure the frontend port. the frontend port will automatically handle /server as a part of itself.


Summary
Adds a reverse proxy to
netalertx:20211/server. This is intended to assist with CORS errors by ensuring the backend API is accessible under the same origin as the frontend.Security Considerations
Known Limitations
This PR does not address the current behavior where backend-provided URLs (e.g.,
https://my.netalertx.com/server) are not respected by the UI. For example, the/serverprefix is ignored in some JavaScript-generated requests. This issue is related to frontend logic and is outside the scope of this PR.Future Work
This PR provides the necessary access method (
/server) so that the JavaScript/PHP behavior of URL truncation ofBACKEND_API_URLcan be corrected or properly implemented in a future update.Summary by CodeRabbit
/server/path with improved request routing, header management, and timeout handling.✏️ Tip: You can customize this high-level summary in your review settings.