Skip to content

Commit d9f5239

Browse files
committed
bug: add cors to domains
1 parent 3eb27c8 commit d9f5239

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/file-manager/file-manager.controller.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ import { HasuraAction } from "../hasura/hasura.controller";
1414

1515
@Controller("file-manager")
1616
export class FileManagerController {
17-
constructor(
18-
private readonly fileManagerService: FileManagerService,
19-
) {}
17+
constructor(private readonly fileManagerService: FileManagerService) {}
2018

2119
@HasuraAction()
2220
async listServerFiles(data: {

src/main.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,23 @@ async function bootstrap() {
7070

7171
const appConfig = configService.get<AppConfig>("app");
7272

73+
const allowedOrigins = [
74+
appConfig.webDomain,
75+
appConfig.apiDomain,
76+
appConfig.relayDomain,
77+
appConfig.demosDomain,
78+
appConfig.wsDomain,
79+
];
80+
7381
if (process.env.DEV) {
74-
app.enableCors({
75-
origin: ["http://localhost:3000", "http://0.0.0.0:3000"],
76-
credentials: true,
77-
});
82+
allowedOrigins.push("http://localhost:3000", "http://0.0.0.0:3000");
7883
}
7984

85+
app.enableCors({
86+
origin: allowedOrigins,
87+
credentials: true,
88+
});
89+
8090
app.use(
8191
session({
8292
rolling: true,

0 commit comments

Comments
 (0)