Part-45: Cloud Functions with HTTPS in GCP

Google Cloud Functions – HTTPS Trigger

Step-01: Introduction

Create Cloud Function with HTTP Trigger
Access Cloud Function on browser and verify
Review all settings in Cloud Run
Edit Cloud Function to deploy v2.js file
Access Cloud Functio…


This content originally appeared on DEV Community and was authored by Latchu@DevOps

Google Cloud Functions - HTTPS Trigger

Step-01: Introduction

  1. Create Cloud Function with HTTP Trigger
  2. Access Cloud Function on browser and verify
  3. Review all settings in Cloud Run
  4. Edit Cloud Function to deploy v2.js file
  5. Access Cloud Function on browser with v2 version and verify
  6. Cloud Run Split Traffic between v1 and v2 and verify

Step-02: Create Cloud Function with HTTPS Trigger

Configuration Tab

f1

f2

  • Environment: 2nd gen (default - Cloud Run will select a suitable execution environment for you.)
  • Function name: cf-demo1-http
  • Region: us-central1
  • Trigger: HTTPS
  • Authentication: Allow unauthenticated invocations

f3

  • REST ALL LEAVE TO DEFAULTS
  • Click to NEXT

Code Tab

Runtime: Nodejs20 (default as on today)

f4

const functions = require('@google-cloud/functions-framework');

functions.http('helloHttp', (req, res) => {
  //res.send(`Hello ${req.query.name || req.body.name || 'World 101'}!`);
  res.send(`
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Cloud Functions Demo</title>
    </head>
    <body style="background-color: lightblue; color: black;">
      <h1>Welcome to Cloud Functions Demo</h1>
      <h2>Application Version: V1</h2>
    </body>
    </html>
  `);
});

  • Review and Deploy

Step-03: Access Application and Verify Cloud Run Service

# Access using Auto-generated URL
https://us-central1-kdaida123.cloudfunctions.net/cloud-function-demo1-http

# Cloud Run Service
1. Go to Cloud Run Service -> cf-demo1-http
2. Review the "Revisions" Tab

f5

Step-04: Deploy V2 of Cloud Function

  • Go to Cloud Functions -> cf-demo1-http -> Source -> Edit

Configuration Tab

  • Click to NEXT

Code Tab

  • Runtime: Nodejs20 (default as on today)
  • COPY the CODE and Deploy

f6

const functions = require('@google-cloud/functions-framework');

functions.http('helloHttp', (req, res) => {
  //res.send(`Hello ${req.query.name || req.body.name || 'World 101'}!`);
  res.send(`
    <!DOCTYPE html>
    <html lang="en">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Cloud Functions Demo</title>
    </head>
    <body style="background-color: lightyellow; color: black;">
      <h1>Welcome to Cloud Functions Demo</h1>
      <h2>Application Version: V2</h2>
    </body>
    </html>
  `);
});

f6

Step-05: Cloud Run - Revisions

Go to Cloud Run -> cf-demo1-http -> Revisions -> Manage Traffic

  • V1 Revision: 50%
  • V2 Revision: 50%

f7

Test it

f8

f9

Traffic's are serving to the both revisions equally!


This content originally appeared on DEV Community and was authored by Latchu@DevOps


Print Share Comment Cite Upload Translate Updates
APA

Latchu@DevOps | Sciencx (2025-09-12T04:28:50+00:00) Part-45: Cloud Functions with HTTPS in GCP. Retrieved from https://www.scien.cx/2025/09/12/part-45-cloud-functions-with-https-in-gcp/

MLA
" » Part-45: Cloud Functions with HTTPS in GCP." Latchu@DevOps | Sciencx - Friday September 12, 2025, https://www.scien.cx/2025/09/12/part-45-cloud-functions-with-https-in-gcp/
HARVARD
Latchu@DevOps | Sciencx Friday September 12, 2025 » Part-45: Cloud Functions with HTTPS in GCP., viewed ,<https://www.scien.cx/2025/09/12/part-45-cloud-functions-with-https-in-gcp/>
VANCOUVER
Latchu@DevOps | Sciencx - » Part-45: Cloud Functions with HTTPS in GCP. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/09/12/part-45-cloud-functions-with-https-in-gcp/
CHICAGO
" » Part-45: Cloud Functions with HTTPS in GCP." Latchu@DevOps | Sciencx - Accessed . https://www.scien.cx/2025/09/12/part-45-cloud-functions-with-https-in-gcp/
IEEE
" » Part-45: Cloud Functions with HTTPS in GCP." Latchu@DevOps | Sciencx [Online]. Available: https://www.scien.cx/2025/09/12/part-45-cloud-functions-with-https-in-gcp/. [Accessed: ]
rf:citation
» Part-45: Cloud Functions with HTTPS in GCP | Latchu@DevOps | Sciencx | https://www.scien.cx/2025/09/12/part-45-cloud-functions-with-https-in-gcp/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.