The sitecore graphql gui uses websockets to communicate with the server. We have a site that is running under https, but it seems that the gui frontend always uses ws instead of switching to it's secure counterpart wss. And that of course does not work. I have been going through the sitecore graphql code and there seems to be now way to force wss, or is there? Or could we also turn off websockets completely?
-
Try and add a include file with following content presented here stockpick.nl/english/caveats-with-jss-graphql-endpoint– Thomas SternOct 3, 2019 at 11:05
1 Answer
Sitecore GraphQL uses Web socket communication to enable "Subscriptions" in GraphQL. As you mentioned, with https hosting it tries to connect to websocket WS protocol which is non secure instead of the WSS secure one.
To bypass Web socket in jss, change the property enableSubscriptions from true to false in the custom config JSS app creates. Image below for reference.
This will bypass web socket while establishing the connection with GraphQL.