Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions portal-ui/src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Api, HttpResponse, Error, FullRequestParams } from "./consoleApi";

export let api = new Api();
api.baseUrl = `${new URL(document.baseURI).pathname}api/v1`;
const internalRequestFunc = api.request;
api.request = async <T = any, E = any>({
body,
Expand Down
7 changes: 5 additions & 2 deletions restapi/ws_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,11 @@ func serveWS(w http.ResponseWriter, req *http.Request) {
errorsApi.ServeError(w, req, errorsApi.New(http.StatusUnauthorized, err.Error()))
return
}
// Development mode validation
if getConsoleDevMode() {

// If we are using a subpath we are most likely behind a reverse proxy so we most likely
// can't validate the proper Origin since we don't know the source domain, so we are going
// to allow the connection to be upgraded in this case.
if getSubPath() != "/" || getConsoleDevMode() {
upgrader.CheckOrigin = func(r *http.Request) bool {
return true
}
Expand Down