LoginSignup
2
0

More than 5 years have passed since last update.

Google App Engineにデプロイしたアプリへの接続を常時https化する

Posted at

やりたいこと

App Engine へデプロイしたアプリへの接続を常時https化したい

https化するための設定項目

app.yamlに 「secure: always」を追加する。

この属性を追加することで、仮にhttpで接続試行した場合もhttpsのURLへリダイレクトされる。
設定例を以下に示す。

app.yaml
handlers:
- url: /.*
  script: main.app
  secure: always

またSecure属性の項目は3つある。
1. optinal: http, httpsどちらのURLでも接続可能。Secure属性を省略した場合、本設定が適用される
2. never: httpsのURLでアクセス試行されたものをhttpのURLへリダイレクト。なおセキュリティを考慮し、リダイレクト時にクエリパラメータはリクエストから除外される。
3. always: 上記参照

参考サイト

[Google Cloud app.yaml リファレンス]
https://cloud.google.com/appengine/docs/standard/python/config/appref

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0