I am using apollo graphql client in react native android app.
my code:
const httpLink = createHttpLink({
uri: “https://89.116.232.181:4000/graphql”, - not real address but the same format
})
const httpLinkWithOptions = ApolloLink.from([
cleanTypeName,
authFlowLink,
httpLink,
])
export const client = new ApolloClient({
link: httpLinkWithOptions,
cache
})
Error : Network request failed
You typically cannot connect via https
to an IP address, because certificate verification for the encryption (the s
) relies on the domain name. I’m actually not sure why that works from sandbox—is it an embedded sandbox from the server or the Apollo-hosted sandbox?
Thank you, for the reply! I set up SSL certificate to the ip address, because i dont need a domain for that kind of server, i hopped to escape requests to the DNS and NS servers, it is working fine with Apollo-hosted sandbox, here is a real link to my api https://89.116.231.180:4000/graphql.
I can change the port, but i dont want to connnect the domain to it, it has literally no sense for that, because no any normal human will read/write this link, just me as a programmer and maybe some hackers(i hope not).
So is it actually may be any option to use SSL with ip address, or i need to rewrite package by myself, if you dont mind it?
It is working fine with unsafe http ip address and with htttps://domain.com, but not with htttps://ip.address