Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for disabling force_ssl for SSL-terminating reverse proxies #794

Closed
ezekg opened this issue Feb 8, 2024 · 1 comment
Closed

Comments

@ezekg
Copy link
Member

ezekg commented Feb 8, 2024

See: maybe-finance/maybe#308. Campfire does the below in config/environments/production.rb, so we should follow suite:

# Always be SSL'ing (unless told not to)
config.assume_ssl = ENV["DISABLE_SSL"].blank?
config.force_ssl  = ENV["DISABLE_SSL"].blank?

Ref: https://github.com/keygen-sh/campfire/blob/f75357eca673fe6f0dce8d5ee98b5d891d330b86/config/environments/production.rb#L58-L60

@ezekg ezekg changed the title Add support for disabling force SSL for SSL-terminating reverse proxies Add support for disabling force_ssl for SSL-terminating reverse proxies Feb 8, 2024
@ezekg
Copy link
Member Author

ezekg commented Feb 14, 2024

It's worth mentioning that any well-behaved reverse proxy should be setting the X-Forwarded-* headers. Namely, X-Forwarded-Proto, which Rails uses to determine if the request is coming from an TLS-terminating reverse proxy. If X-Forwarded-Proto: https, then Rails will NOT redirect the request, because it knows it's coming from a TLS-terminating reverse proxy. So the only case where config.force_ssl = false is actually needed is for misbehaving reverse proxies.

Not needed: maybe-finance/maybe#308 (comment).

@ezekg ezekg closed this as completed Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant