2

I have deployed a site on google cloud on Nodejs environment. I want to redirect the user from http to https as i want to make https as default. I have already attached SSL certificate with my custom domain in App engine and it is working fine. I also tried to redirect to https from node but none is working on google cloud.

I am having less knowledge of cloud if things did not work then i have to migrate to Heroku.

kapoorji
  • 158
  • 12

1 Answers1

4

You have to setup it in your app.yaml

handlers:
- url: /.*
  script: IGNORED
  secure: always

See https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml#security

Igor Artamonov
  • 35,450
  • 10
  • 82
  • 113
  • Thanks Igor for help, I am stuck in somewhere i want to redirect all my request to naked domain like (https://www.example.com) to (https://example.com) , Can it be done from node end , i found this post http://stackoverflow.com/questions/19473222/nodejs-redirect-all-non-www-to-www-except-subdomains – kapoorji May 12 '16 at 17:33
  • I believe it's much easier to configure this on domain registrator panel, many of them are providing such feature for free – Igor Artamonov May 12 '16 at 17:46
  • Thanks Igor for help but domain registrar does not work for me, so i redirected all calls to www subdomain using node code. – kapoorji May 24 '16 at 12:42
  • yes, if DNS is already configured, then it's possible to do on server, likes it's done in mentioned post – Igor Artamonov May 24 '16 at 13:57
  • I got this error testing this code: Unexpected attribute 'secure' for object of type AppInfoExternal. – Alan Donizete Sep 07 '17 at 18:29
  • 1
    It seems like `handlers` are ignored for Node apps. – Gustavo Straube Sep 28 '17 at 21:58