Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

request scheme reports http when requested over https

Hello community, I'm new to this forum so forgive me if I don't know the correct etiquette.

I'm having a very odd issue.

I'm migrating from google app engine to cloud run using the automatic build pack for Python3.10

My app uses Flask and whenever I query `request.scheme` or `request.host_url` etc I get 'http' even when I explicitly request a https route from the browser and there is a reassuring lock icon confirming it is all over https. (This was not happening in the app engine.)

Anyone have any idea why my request might be getting downgraded to http or why the request object would be incorrect?

Any help would be greatly appreciated.

 

```

steps:
- name: gcr.io/k8s-skaffold/pack
env:
- GOOGLE_ENTRYPOINT=$_ENTRYPOINT
args:
- build
- >-
$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA
- '--builder=gcr.io/buildpacks/builder:v1'
- '--network=cloudbuild'
- '--path=.'
- '--env=GOOGLE_ENTRYPOINT'
id: Buildpack
entrypoint: pack
- name: gcr.io/cloud-builders/docker
args:
- push
- >-
$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA
id: Push
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
args:
- run
- services
- update
- $_SERVICE_NAME
- '--platform=managed'
- >-
--image=$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA
- >-
--labels=managed-by=gcp-cloud-build-deploy-cloud-run,commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID
- '--region=$_DEPLOY_REGION'
- '--quiet'
id: Deploy
entrypoint: gcloud
images:
- >-
$_AR_HOSTNAME/$PROJECT_ID/cloud-run-source-deploy/$REPO_NAME/$_SERVICE_NAME:$COMMIT_SHA
options:
substitutionOption: ALLOW_LOOSE
substitutions:
_SERVICE_NAME: ista-run-dev
_ENTRYPOINT: 'gunicorn --bind :$PORT main:app'
_DEPLOY_REGION: europe-west1
_AR_HOSTNAME: europe-west1-docker.pkg.dev
_PLATFORM: managed
_TRIGGER_ID: 2f71d830-b963-4657-b253-c0dffc867342
tags:
- gcp-cloud-build-deploy-cloud-run
- gcp-cloud-build-deploy-cloud-run-managed
- ista-run-dev

```

0 1 464
1 REPLY 1

Hi @joymittens,

Welcome to the Google Cloud Community!

You can try the following troubleshooting options:

  1. You should look into the documentation, Invoking with an HTTPS Request. You can send HTTPS requests to trigger any Cloud Run services. 
  2. Set up an HTTP-to-HTTPS Redirect for a Classic Application Load Balancer. You have to set up a load balancer using the Google Cloud Console. This will then direct all your requests from HTTP to HTTPS.
  3. Check this blog out to learn more about Google Cloud Run - HTTPS
  4. You can also get in touch with Google Cloud Support if the above options don't work.

Let me know if it helped, thanks!