Skip to content

HTTPS #210

@Gipphe

Description

@Gipphe

Are there any plans to implement an HTTPS setup? As it currently stands, it is (as far as I can tell) no way to initialize GraphQLServer with HTTPS, or the https module for that matter.

Activity

orefalo

orefalo commented on Mar 13, 2018

@orefalo

IMHO, not required: can be easily done with a proxy. I will also argue a DMZ is required in a proper architecture.

IT is all above divide and conquer...

kachkaev

kachkaev commented on Mar 14, 2018

@kachkaev
Contributor

@Gipphe even if HTTPS becomes a part of GraphQL yoga, you'll still need it for other parts of your app (such as web frontend). The easiest way to enable HTTPS for all your workload is to run a reverse-proxy such as traefik in front all of them.

douglaseggleton

douglaseggleton commented on Mar 14, 2018

@douglaseggleton
Contributor

I had to run HTTPS everywhere which meant I ended up not using yoga due to this. It would have been a great help at the time. However, the service is running in a docker swarm - perhaps a proxy was the right answer. 🐢

kachkaev

kachkaev commented on Mar 14, 2018

@kachkaev
Contributor

@douglaseggleton a proxy is the answer indeed. Without it, your apps have has to sit in their own domain because HTTPS certs are managed independently. With a ‘switchboard container’ that sits in front of all your Node.js apps (e.g. traefik) you can have https://example.com resolved to your frontend while https://example.com/graphql pointing to your GraphQL backend. Both microservices will be the same valid HTTPS cert and it will be even auto-renewed by the reverse-proxy once needed.

schickling

schickling commented on Mar 14, 2018

@schickling
Contributor

While I completely agree that using a proxy is the preferred solution (especially given today's cloud offering like AWS API Gateway, now etc), I still think that this shouldn't be a entry barrier/blocker for people like @douglaseggleton or @Gipphe.

Let's try to see whether we can also support HTTPS without making graphql-yoga more complicated to use/understand. Does someone have some API suggestions?

douglaseggleton

douglaseggleton commented on Mar 14, 2018

@douglaseggleton
Contributor

This could be passed as a property to the start method to have the option to create a secure server instance. 💫

i.e.

server.start({
  ...opts,
  https: {
    key: fs.readFileSync(keyPath),
    cert: fs.readFileSync(certPath)
  }
});

e.g. douglaseggleton@c9252cf

Gipphe

Gipphe commented on Mar 15, 2018

@Gipphe
Author

While a reverse-proxy would certainly be a solution, we have a desire to keep everything on HTTPS internally as well, preferably without having to use a reverse-proxy internally for each service. We are gradually replacing and "prettying up" old APIs with GraphQL implementations at our place, so I thank you for taking this into consideration, even though it fits only a very small subset of use-cases in today's IT world.

schickling

schickling commented on Mar 15, 2018

@schickling
Contributor

@Gipphe fully agree! 👍

@douglaseggleton this looks great! Can you submit a PR for this? :shipit:

trixobird

trixobird commented on May 31, 2024

@trixobird
Contributor

this seems that is not working in version 5

ardatan

ardatan commented on May 31, 2024

@ardatan
Member

Could you please create a new issue with a reproduction @trixobird

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @orefalo@kachkaev@douglaseggleton@schickling@Gipphe

        Issue actions

          HTTPS · Issue #210 · graphql-hive/graphql-yoga