Cannot connect to GraphQL endpoint

Hey all

I’ve done a really basic installation of DGraph that looks a little something like this:

  1. Spun up a DigitalOcean droplet
  2. Installed Docker
  3. Ran dgraph/dgraph:latest with docker-compose

My docker compose file looks like:

version: "3.2"
services:
  zero:
    image: dgraph/dgraph:latest
    volumes:
      - /mnt/volume_xxxxx:/dgraph
    ports:
      - 5080:5080
      - 6080:6080
    restart: on-failure
    command: dgraph zero --my=zero:5080
  alpha:
    image: dgraph/dgraph:latest
    volumes:
      - /mnt/volume_xxxxx/dgraph:/dgraph
    environment:
      DGRAPH_ALPHA_ACL: secret-file=./secret_file
      DGRAPH_ALPHA_SECURITY: whitelist=10.0.0.0/8,172.0.0.0/8,192.168.0.2/16
    ports:
      - 8080:8080
      - 9080:9080
    restart: on-failure
    command: dgraph alpha --my=alpha:7080 --zero=zero:5080
  ratel:
    image: dgraph/ratel:latest
    ports:
      - 8000:8000
    command: dgraph-ratel

I’m able to connect to the Ratel UI via http://xxx.xxx.xx.xxx:8000 and play around just fine, however I cannot connect via https://play.dgraph.io/

Additionally, opening up the GraphQL endpoint in Altair (via browser extension) or any other GraphQL UI doesn’t work either.

Am I missing something? Any help is appreciated.

Try whitelist=0.0.0.0/0
More precisely whitelist=*.dgraph.io

@star no luck. The whitelist doesn’t seem to like *.dgraph.io. I also tried specifically both 0.0.0.0/0 and 172.67.72.127 and it still doesn’t work.

After some more debugging, it looks like it’s a CORS issue. Now to figure out how to fix that… :thinking:

Anyways finally had some time to take another crack at this. I notice the CORs issues were due to Referrer-Policy: no-referrer-when-downgrade.

I figured it was because I was connecting from https://play.dgraph.io/ to http://xxx.xxx.xx.xxx:8000, meaning, it went from HTTPS to HTTP, so the referrer header was lost due to the policy.

To fix this, I went ahead and set up my server with a domain and SSL cert. After doing so, connecting from https://play.dgraph.io/ to https://my-domain.com/dgraph totally works as expected.

And also consequently, connecting from a GraphQL client (like Altair) works as well :+1:

More about this