jenkins 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp
latest 0.0.0.0:3005->3005/tcp, :::3005->3005/tcp
mongodb 0.0.0.0:27517->27017/tcp, :::27517->27017/tcp
nginx 0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp, :::80->80/tcp, :::443->443/tcp
nuxt 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp
const cors = require('cors')
const allowedOrigins = [
"http://localhost:8081",
"http://localhost:8080",
...
];
let corsOptions = {
origin: function (origin, callback) {
if(allowedOrigins.indexOf(origin) !== -1){
callback(null, true)
} else {
callback(null, false)
}
},
methods: ['GET', 'PUT', 'POST', 'DELETE'],
optionsSucccessStatus: 200,
credentials: true,
allowedHeaders: ['Content-Type', 'Authorization', 'X-Requested-With', 'device-remember-token', 'Access-Control-Allow-Origin', 'Origin', 'Accept']
}
app.use(cors(corsOptions))
const io = require("socket.io")(server, {
cors: corsOptions,
transports: ['websocket', 'polling']
});
import io from 'socket.io-client'
import VueSocketIO from 'vue-socket.io'
Vue.use(new VueSocketIO({
connection: io('http://localhost:8081/')
}))