[SOLVED] CORS since 0.2.X


#1

Since 0.2.X i’ve been dealing with a new CORS issue. On my machine i can access great, ip or localhost:3000.

The problem starts when i try to access from other computer, first it asked for CORS, so i added it… now i get BAD request to
But if i go to other machine i get “bad request” when i add cors to Express (with Meteor).

this is my client:


EDIT SOLVED: added //my_server_ip:3010

const networkInterface= createNetworkInterface(
    'http://localhost:3010/graphql',
    {
      credentials:'same-origin',
    }
);

this is my server:


const GQL_PORT=3010;

var api = express().use('*', cors());

const schemaDefinition = makeExecutableSchema({
  typeDefs: schema,
  resolvers,
});

api.use('/graphql',
  bodyParser.json(),
  apolloExpress((req) => {
    let options = {
      schema: schemaDefinition,
    }
    return options;
  }
));

api.use('/graphiql', graphiqlExpress({
  endpointURL: '/graphql',
}));

api.listen(GQL_PORT);

WebApp.rawConnectHandlers.use(
  proxyMiddleware(`http://localhost:${GQL_PORT}/graphql`)
);

Is there any configuration im missing ?