Skip to content

Commit

Permalink
fix: make shell feature can work behind web proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
samlm0 committed Jan 19, 2024
1 parent f2d6632 commit a8f8e09
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions backend/als/controller/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package shell

import (
"context"
"fmt"
"net/http"
"os"
"os/exec"
"strconv"
Expand All @@ -19,8 +21,10 @@ var upgrader = websocket.Upgrader{
}

func HandleNewShell(c *gin.Context) {
upgrader.CheckOrigin = func(r *http.Request) bool { return true }
conn, err := upgrader.Upgrade(c.Writer, c.Request, nil)
if err != nil {
fmt.Println(err)
return
}
defer conn.Close()
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/Utilities/Shell.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ onMounted(() => {
const url = new URL(location.href)
const protocol = url.protocol == 'http:' ? 'ws:' : 'wss:'
websocket = new WebSocket(
protocol + '//' + url.host + '/session/' + useAppStore().sessionId + '/shell'
protocol + '//' + url.host + url.pathname + 'session/' + useAppStore().sessionId + '/shell'
)
websocket.binaryType = 'arraybuffer'
websocket.addEventListener('message', (event) => {
Expand Down

0 comments on commit a8f8e09

Please sign in to comment.