aws fargate prisma
Hello everybody.
In AWS Fargate I run two services, a prisma server and a graphql server (using apollo-server-express, graphql-middleware and cors).
I don't understand why I got this error in chrome (v76) everytime I made a request from client side (first image).
This is my configuration from server (second image).
Thanks in advance for any hint.
a
Alexander
08/16/2019, 10:31 AM
Subdomains are different so you should add cors options with origin header to express config.
e.g.
const corsOptions = {
optionsSuccessStatus: 200,
credentials: true,
origin(origin, callback) {
if (
origin === 'XXXXX'
) {
callback(null, true);
} else {
callback(null, false);
}
},
};
app.use(cors(corsOptions));
a
Andrei Bacescu
08/16/2019, 10:45 AM
@Alexander Thank you for the message. I will try what you suggested.
Andrei Bacescu
08/16/2019, 11:20 AM
the main idea is that we need to check the req. headers .. .we only have access to them using corsDelegate ... is optionsSuccessStatus: 200 the option that should help fix the issue?