Search code examples
azuresslwebsockethttps

I have no idea how to connect server and client with https or wss


I am trying to deploy my web application and I am using

  • azure virtual machine for my server
  • azure app service for my client

The problem is client page is given https:// but my server only support http://
The page works if I change the domain name https to http, but some of my APIs only runs on https so I need to make the server support https.

My code for connecting to server is like this below.

const httpLink = new HttpLink({
  uri: "http://{my_virtual_machine_ipAddress}:4000/graphql"
});

const wsLink = new WebSocketLink({
  uri: "ws://{my_virtual_machine_ipAddress}:4000/subscriptions"
});

I want to make http to https, ws to wss!

const httpLink = new HttpLink({
  uri: "https://{my_virtual_machine_ipAddress}:4000/graphql"
});

const wsLink = new WebSocketLink({
  uri: "wss://{my_virtual_machine_ipAddress}:4000/subscriptions"
});


I was thinking to install apache on virtual machine and do the openssl. Is this the right way or is there any other way to make my server support https on azure?


Solution

  • A VM with nginx or Apache would be a good choice.

    Out of the box Laravel Homestead comes equipped with what you need

    https://laravel.com/docs/5.8/homestead

    It ships with SSL support for nginx

    If you go with this, note that for development Port, you will need to use Port 8443