Catalogue
Nginx ssl.conf Settings - Redirecting Only Specific Pages to HTTPS

Nginx ssl.conf Settings - Redirecting Only Specific Pages to HTTPS

🌐 日本語で読む

Overview

I’m running the Go Revel framework on top of Nginx.

In doing so, I needed to configure SSL settings as well as
set up a way to redirect only specific pages to HTTPS,
so I’ve summarized it below.

The pages I want served over HTTPS are as follows:

  • /register
  • /mypage
  • /login
  • /logout

For the pages I want served over HTTPS, I match the prefix using a regular expression (~) in the location block,
and when the request comes over HTTP, I issue a 301 redirect to HTTPS.

That’s all.

Nginx ssl.conf Settings - Redirecting Only Specific Pages to HTTPS

https://kenzo0107.github.io/en/2015/09/14/nginx-redirect-https/

Author

Kenzo Tanaka

Posted on

2015-09-14

Licensed under