denvned/isomorphic-relay-router

Absolute URL for NetworkLayer not working

Closed this issue · 4 comments

mmjd commented

in client.js of the todo example, setting an absolute URL to DefaultNetworkLayer will raise 404 error. it still tries to connect to http://localhost:8080/graphql. what is the problem?

Are you sure it tries to connect to localhost? Can't it be that it actually tries to connect to the host specified by the absolute URL, but the host's CORS settings (or their absence) don't allow connection?

mmjd commented

server rendering is done successfully using the same URL at server but when a mutation is applied at client-side, it tries to connect to http://localhost:8000/graphql which is nodejs server but the URL I have configured is http://localhost/8080/myproject/graphql (CORS enabled Java server) and it raises 404. when I inject networkLayer to Relay in addition to environment at client-side, it works as expected.

To apply mutations you need to use the relay prop passed to your component instead of global Relay.Store.

mmjd commented

thank you