Skip to content

Commit

Permalink
force ssl only if host passed
Browse files Browse the repository at this point in the history
  • Loading branch information
omohokcoj committed Oct 29, 2023
1 parent 607fc8d commit 50d3404
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
# config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]

# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
config.force_ssl = ENV['FORCE_SSL'] == 'true'
config.force_ssl = ENV['FORCE_SSL'].present?

# Include generic and useful information about system operation, but avoid logging too much
# information to avoid inadvertent exposure of personally identifiable information (PII).
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ services:
volumes:
- .:/data
environment:
FORCE_SSL: 'true'
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/docuseal
- FORCE_SSL=${HOST}
- DATABASE_URL=postgresql://postgres:postgres@postgres:5432/docuseal

postgres:
image: postgres:15
Expand Down
2 changes: 1 addition & 1 deletion lib/docuseal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module Docuseal

DEFAULT_URL_OPTIONS = {
host: HOST,
protocol: ENV['FORCE_SSL'] == 'true' ? 'https' : 'http'
protocol: ENV['FORCE_SSL'].present? ? 'https' : 'http'
}.freeze

module_function
Expand Down

0 comments on commit 50d3404

Please sign in to comment.