How to redirect all HTTP traffic to HTTPS in Flex Custom env?
66 views
Skip to first unread message
Sergey Shekyan
unread,
Apr 18, 2017, 10:49:13 AM4/18/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
Cannot really figure out how redirect all HTTP traffic to HTTPS with 301 redirect.
It is a node app with a Java dependency.
In app.yaml added
```
handlers:
-url: /.*
script: ignored
secure: always
redirect_http_response_code:301
```
but nothing really changes.
Sergey Shekyan
unread,
Apr 18, 2017, 10:49:20 AM4/18/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
Answer to myself: handlers are not supported in custom flex environment. Using koa-sslify solved my problem.
Nicholas (Google Cloud Support)
unread,
Apr 18, 2017, 3:41:18 PM4/18/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google App Engine
You are correct. secure handlers have been deprecated for the App Engine flexible environment. The current recommendation is to use the Strict-Transport-Security response header. Clients should then know to use HTTPS for future requests. I'd also recommend redirecting the initial request to HTTPS as well with a 302 or 301 to ensure no insecure content is sent.
Note that the Google Cloud Load Balancer terminates all HTTPS connection and forward traffic to your application over HTTP. The X-Forwarded-Proto request header should be consulted to determine if the original request was over HTTP or HTTPS. It seems like the library you linked, koa-sslify, has an option to respect this header: trustProtoHeader. I've not tested it myself but would be worth trying if using that middleware.