Skip to content

Commit 5145761

Browse files
committed
changes redone
1 parent ab448ac commit 5145761

3 files changed

Lines changed: 16 additions & 14 deletions

File tree

api-gateway/src/middleware/security.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const applySecurityMiddleware = (app: Application) => {
1919
console.log('Setting up CORS with client URL:', Service.CLIENT_URL);
2020

2121
app.use(cors({
22-
origin: "*",
22+
origin: Service.CLIENT_URL,
2323
methods: ["GET", "POST", "HEAD", "PUT", "PATCH", "DELETE", "OPTIONS"],
2424
credentials: true,
2525
allowedHeaders: ['Content-Type', 'Authorization', 'Cookie', 'Range', 'Accept'],

api-gateway/src/redirect-debug.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const redirectDebugMiddleware = (req: Request, res: Response, next: Funct
1919
cookies: req.cookies,
2020
query: req.query,
2121
};
22+
console.log(requestInfo,"request information")
2223

2324
// Clean up sensitive information
2425
if (requestInfo.headers.authorization) {
@@ -27,6 +28,17 @@ export const redirectDebugMiddleware = (req: Request, res: Response, next: Funct
2728
if (requestInfo.headers.cookie) {
2829
requestInfo.headers.cookie = '[REDACTED]';
2930
}
31+
console.log({
32+
message: "Redirect debugging information",
33+
requestInfo,
34+
serverInfo: {
35+
timestamp: new Date().toISOString(),
36+
nodeVersion: process.version,
37+
env: {
38+
NODE_ENV: process.env.NODE_ENV,
39+
}
40+
}
41+
})
3042

3143
res.status(200).json({
3244
message: "Redirect debugging information",

auth-service/src/presentation/server.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,13 @@ if(process.env.NODE_ENV === "development"){
3030
// }));
3131

3232

33-
// app.use(cors({
34-
// origin: 'https://v-learning-client-5r8j.vercel.app',
35-
// methods: ["GET", "POST", "HEAD", "PUT", "PATCH", "DELETE", "OPTIONS"],
36-
// credentials: true,
37-
// allowedHeaders: ['Content-Type', 'Authorization', 'Cookie', 'Range', 'Accept'],
38-
// exposedHeaders: ['Content-Disposition', 'Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type']
39-
// }));
40-
41-
const corsOptions = {
42-
origin: '*' ,
33+
app.use(cors({
34+
origin: 'https://v-learning-client-5r8j.vercel.app',
4335
methods: ["GET", "POST", "HEAD", "PUT", "PATCH", "DELETE", "OPTIONS"],
4436
credentials: true,
4537
allowedHeaders: ['Content-Type', 'Authorization', 'Cookie', 'Range', 'Accept'],
4638
exposedHeaders: ['Content-Disposition', 'Content-Range', 'Accept-Ranges', 'Content-Length', 'Content-Type']
47-
};
48-
49-
app.use(cors(corsOptions));
39+
}));
5040

5141
app.use('/',routes(dependencies));
5242

0 commit comments

Comments
 (0)