Skip to content

Commit

Permalink
Force SSL + Forward SSL from Nginx to the container
Browse files Browse the repository at this point in the history
Was causing http urls instead of https. see:
#166

Solution is to force use SSL, and forward it from Nginx to the container
See more: rails/rails#22965
  • Loading branch information
viktorsmari committed Apr 30, 2020
1 parent 88f9a16 commit db5f3e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
config.active_storage.service = :amazon

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
config.force_ssl = true

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
Expand Down
2 changes: 2 additions & 0 deletions scripts/nginx-conf/api.smartcitizen.me.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ server {

location @app {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Ssl on; # Optional
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
Expand Down Expand Up @@ -69,6 +70,7 @@ server {
location @app {
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on; # Optional
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app:3000;
Expand Down

0 comments on commit db5f3e7

Please sign in to comment.