Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
middleware remved for host not match (origin undefined) issue
Browse files Browse the repository at this point in the history
now deployments have web token security, all other endpoints are secured by https
  • Loading branch information
Hammad-Mubeen committed May 31, 2022
1 parent 84053c6 commit 6b4ed84
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 50 deletions.
35 changes: 25 additions & 10 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,25 @@ connect.then(
}
);

app.use('/', indexRouter);

app.use("/", adminRouter);
app.use("/", afterDeploymentRouter);
app.use(
"/graphql",
graphqlHTTP({
schema: schema,
graphiql: true,
})
);
const headerMiddleware = require("./middlewares/HeaderMiddleware");
app.use(headerMiddleware);

app.use((req, res, next) => {
res.setHeader("Access-Control-Allow-Origin", "*");
res.setHeader(
"Access-Control-Allow-Methods",
"OPTIONS, GET, POST, PUT, PATCH, DELETE"
);
res.setHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");

if (req.method === "OPTIONS") {
return res.sendStatus(200);
}
next();
});

app.use('/', indexRouter);
app.use("/", listenerRouter);
app.use("/", tokensListRouter);
app.use("/", deploypairRouter);
Expand All @@ -86,6 +93,14 @@ app.use("/", pathRouter);
app.use("/", readWasmRouter);
app.use("/", setUserForRemoveLiquidityCSPRRouter);

app.use(
"/graphql",
graphqlHTTP({
schema: schema,
graphiql: true,
})
);

// catch 404 and forward to error handler
app.use(function (req, res, next) {
next(createError(404));
Expand Down
40 changes: 0 additions & 40 deletions middlewares/HeaderMiddleware.js

This file was deleted.

0 comments on commit 6b4ed84

Please sign in to comment.