Brace Sproul
Brace Sproul

Reputation: 803

Node js express server on GCP VM giving SSL error

I'm trying to access an express.js node server I'm hosting on GCP and I'm getting this error:

This site can’t provide a secure connection
<server ip> sent an invalid response.
ERR_SSL_PROTOCOL_ERROR

I looked at another stack overflow answer and they said to edit default-allow-internal in the network tab to allow all, my network tab looks like this now: enter image description here

My server starts fine and I know the logic inside works (it contains a scraper that logs to the console every time it runs and I can see it's succeeding there) But I can't access it via it's external IP https://<ip>:8000

Upvotes: 0

Views: 274

Answers (1)

Fariya Rahmat
Fariya Rahmat

Reputation: 3220

As @Zac Anger suggested the easiest option is to use Load Balancer for terminating SSL at your server.

As given in the document:

HTTP(S) load balancing can balance HTTP and HTTPS traffic across multiple backend instances, across multiple regions. Your entire app is available via a single global IP address, resulting in a simplified DNS setup. HTTP(S) load balancing is scalable, fault-tolerant, requires no pre-warming, and enables content-based load balancing. For HTTPS traffic, it provides SSL termination and load balancing.

To terminate SSL follow the below steps:

  1. Create an instance group that has at least 1 live instance.

  2. Create http load balancer with the following:

    1. Upload a SSL certificate.

    2. Create a backend service to point to the instance group. Make sure the protocol is HTTP.

    3. Create a target https proxy with the certificate you uploaded.

    4. Finally, create a global forwarding rule that points HTTPS to the target proxy you created before.

Upvotes: 2

Related Questions