I'm trying to configure my Google App Engine service to redirect all http traffic to https traffic. I've gone through the documentation and this configuration in my app.yaml file seems like it should work but it does not.
app.yaml:
runtime: nodejs
env: flex
handlers:
- url: /.*
script: server.js
secure: always
server.js is the file Node needs to run to start the service and is the target for npm run start.
I found the answer in the documentation. The suggested duplicate answer on SO is not entirely correct in that handlers are supported, but the secure setting has been deprecated.
https://cloud.google.com/appengine/docs/flexible/nodejs/upgrading
It suggests using use the X-Forwarded-Proto or HTTP Strict Transport Security response header in your application instead.