🔒 CORS configuration in docker-compose and Express
This commit is contained in:
@@ -12,8 +12,6 @@ services:
|
|||||||
- "8050:8050"
|
- "8050:8050"
|
||||||
- "3050:3050"
|
- "3050:3050"
|
||||||
- "8051:8051"
|
- "8051:8051"
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- rabbitmq
|
- rabbitmq
|
||||||
- db
|
- db
|
||||||
@@ -32,8 +30,6 @@ services:
|
|||||||
container_name: comicvine-api
|
container_name: comicvine-api
|
||||||
ports:
|
ports:
|
||||||
- "3080:3080"
|
- "3080:3080"
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
environment:
|
environment:
|
||||||
SERVICES: api
|
SERVICES: api
|
||||||
env_file: ./docker-env/comicvine-service.env
|
env_file: ./docker-env/comicvine-service.env
|
||||||
@@ -50,8 +46,6 @@ services:
|
|||||||
network: host
|
network: host
|
||||||
image: frishi/comicvine-service
|
image: frishi/comicvine-service
|
||||||
container_name: comicvine-service
|
container_name: comicvine-service
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
environment:
|
environment:
|
||||||
SERVICES: comicvine
|
SERVICES: comicvine
|
||||||
volumes:
|
volumes:
|
||||||
@@ -66,8 +60,6 @@ services:
|
|||||||
network: host
|
network: host
|
||||||
image: frishi/threetwo-import-service
|
image: frishi/threetwo-import-service
|
||||||
container_name: threetwo-import-api
|
container_name: threetwo-import-api
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
ports:
|
ports:
|
||||||
- "3000:3000"
|
- "3000:3000"
|
||||||
environment:
|
environment:
|
||||||
@@ -88,8 +80,6 @@ services:
|
|||||||
network: host
|
network: host
|
||||||
image: frishi/threetwo-import-service
|
image: frishi/threetwo-import-service
|
||||||
container_name: import
|
container_name: import
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- nats
|
- nats
|
||||||
@@ -108,8 +98,6 @@ services:
|
|||||||
network: host
|
network: host
|
||||||
image: frishi/threetwo-import-service
|
image: frishi/threetwo-import-service
|
||||||
container_name: image-transformation
|
container_name: image-transformation
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./userdata:/threetwo-import-service/userdata
|
- ./userdata:/threetwo-import-service/userdata
|
||||||
- ./comics:/threetwo-import-service/comics
|
- ./comics:/threetwo-import-service/comics
|
||||||
@@ -141,8 +129,6 @@ services:
|
|||||||
nginx:
|
nginx:
|
||||||
image: nginx
|
image: nginx
|
||||||
container_name: reverse-proxy
|
container_name: reverse-proxy
|
||||||
extra_hosts:
|
|
||||||
- "host.docker.internal:host-gateway"
|
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"compromise-dates": "^2.2.1",
|
"compromise-dates": "^2.2.1",
|
||||||
"compromise-numbers": "^1.4.0",
|
"compromise-numbers": "^1.4.0",
|
||||||
"compromise-sentences": "^0.3.0",
|
"compromise-sentences": "^0.3.0",
|
||||||
|
"cors": "^2.8.5",
|
||||||
"dayjs": "^1.10.6",
|
"dayjs": "^1.10.6",
|
||||||
"ellipsize": "^0.1.0",
|
"ellipsize": "^0.1.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
server {
|
server {
|
||||||
listen 8050;
|
listen 8050;
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://host.docker.internal:8050;
|
proxy_pass http://localhost:8050;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 3080;
|
listen 3080;
|
||||||
|
|
||||||
location /comicvine-service {
|
location /comicvine-service {
|
||||||
proxy_pass http://host.docker.internal:3080;
|
proxy_pass http://localhost:3080;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 3000;
|
listen 3000;
|
||||||
|
|
||||||
location /import {
|
location /import-service {
|
||||||
proxy_pass http://host.docker.internal:3000;
|
proxy_pass http://localhost:3000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,13 +3,20 @@ import bodyParser from "body-parser";
|
|||||||
import { createServer } from "http";
|
import { createServer } from "http";
|
||||||
import { Server } from "socket.io";
|
import { Server } from "socket.io";
|
||||||
import router from "./route";
|
import router from "./route";
|
||||||
|
import cors from "cors";
|
||||||
const amqp = require("amqplib/callback_api");
|
const amqp = require("amqplib/callback_api");
|
||||||
|
|
||||||
// call express
|
// call express
|
||||||
const app: Express = express(); // define our app using express
|
const app: Express = express(); // define our app using express
|
||||||
|
app.use(cors({ origin: "*" }));
|
||||||
|
|
||||||
const httpServer = createServer();
|
const httpServer = createServer();
|
||||||
export const io = new Server(httpServer, {});
|
export const io = new Server(httpServer, {
|
||||||
|
cors: {
|
||||||
|
origin: "*",
|
||||||
|
methods: ["GET", "POST"],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// configure app to use bodyParser for
|
// configure app to use bodyParser for
|
||||||
// Getting data from body of requests
|
// Getting data from body of requests
|
||||||
|
|||||||
@@ -4151,7 +4151,7 @@ core-util-is@~1.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
|
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.3.tgz#a6042d3634c2b27e9328f837b965fac83808db85"
|
||||||
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
|
integrity sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==
|
||||||
|
|
||||||
cors@~2.8.5:
|
cors@^2.8.5, cors@~2.8.5:
|
||||||
version "2.8.5"
|
version "2.8.5"
|
||||||
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
|
resolved "https://registry.yarnpkg.com/cors/-/cors-2.8.5.tgz#eac11da51592dd86b9f06f6e7ac293b3df875d29"
|
||||||
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
|
integrity sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==
|
||||||
|
|||||||
Reference in New Issue
Block a user