Attempt #3 to fix CORS issue and docker build.
This commit is contained in:
@@ -21,15 +21,17 @@ http {
|
|||||||
|
|
||||||
# Proxy IO requests
|
# Proxy IO requests
|
||||||
location /socket.io/ {
|
location /socket.io/ {
|
||||||
proxy_pass http://localhost:8081;
|
proxy_pass http://0.0.0.0:8081;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
proxy_set_header Connection 'upgrade';
|
proxy_set_header Connection 'upgrade';
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
proxy_cache_bypass $http_upgrade;
|
proxy_cache_bypass $http_upgrade;
|
||||||
|
|
||||||
# CORS headers
|
# CORS settings
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
add_header 'Access-Control-Allow-Origin' '*';
|
||||||
|
add_header 'Access-Control-Allow-Methods' '*';
|
||||||
|
add_header 'Access-Control-Allow-Headers' '*';
|
||||||
}
|
}
|
||||||
|
|
||||||
# Error pages
|
# Error pages
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export function NewTerminal({ hostConfig }) {
|
|||||||
let ioUrl = `${isSecure ? "https" : "http"}://${window.location.hostname}:8081/socket.io/`;
|
let ioUrl = `${isSecure ? "https" : "http"}://${window.location.hostname}:8081/socket.io/`;
|
||||||
|
|
||||||
if (window.location.hostname === "localhost") {
|
if (window.location.hostname === "localhost") {
|
||||||
ioUrl = "http://localhost:8081";
|
ioUrl = "http://192.210.197.55:8000/socket.io/";
|
||||||
}
|
}
|
||||||
|
|
||||||
const socket = io(ioUrl);
|
const socket = io(ioUrl);
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ const SSHClient = require("ssh2").Client;
|
|||||||
const server = http.createServer();
|
const server = http.createServer();
|
||||||
const io = socketIo(server, {
|
const io = socketIo(server, {
|
||||||
cors: {
|
cors: {
|
||||||
origin: "*",
|
origin: "*", // Allow all origins
|
||||||
methods: ["GET", "POST"]
|
methods: ["*"], // Allow all methods
|
||||||
|
allowedHeaders: ["*"], // Allow all headers
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user