Enable assume_ssl for reverse proxy HTTPS callbacks #156
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "154-enable-assume-ssl-v2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
config.assume_sslso Rails trusts X-Forwarded-Proto from the Tailscale funnel reverse proxyhttp://callback URLs which Keycloak rejects asinvalid_redirect_uriChanges
config/environments/production.rb: Uncommentedconfig.assume_ssl = trueTest Plan
Review Checklist
Related Notes
ldraney/landscaping-assistant #154— Fix Keycloak login: enable assume_ssl for reverse proxylandscaping-assistantprojectCloses #154
PR #156 Review
DOMAIN REVIEW
Stack: Ruby on Rails 7.1+ production configuration
config.assume_ssl = trueis the correct Rails setting for apps behind an SSL-terminating reverse proxy (Tailscale funnel in this case). It tells ActionDispatch to trust theX-Forwarded-Protoheader when generating URLs, which fixes OmniAuth buildinghttp://callback URLs that Keycloak rejects asinvalid_redirect_uri.Key observations:
force_sslremains commented out (line 31), which is correct -- the reverse proxy handles SSL termination, so Rails should not enforce its own HTTPS redirects.assume_sslhandles protocol detection viaX-Forwarded-Protoout of the box.BLOCKERS
None.
This is a config-only change (uncommenting a Rails default), not new application logic. No test coverage is required for toggling a framework configuration flag. No user input, secrets, or auth logic is introduced.
NITS
SOP COMPLIANCE
154-enable-assume-ssl-v2)Closes #154presentPROCESS OBSERVATIONS
Minimal-blast-radius fix for a production auth regression. The change is well-scoped and low-risk. The manual test plan (click Sign in, verify Keycloak login form, verify authenticated redirect) is appropriate for a config change that cannot be unit tested. Superseding #155 with a rebased branch rather than force-pushing is good practice.
VERDICT: APPROVED
PR #156 Review
DOMAIN REVIEW
Tech stack: Ruby on Rails (production environment configuration)
Change: Uncomments
config.assume_ssl = trueinconfig/environments/production.rb(1 addition, 1 deletion, 1 file).Correctness: This is the correct fix. When Rails runs behind an SSL-terminating reverse proxy (Tailscale funnel in this case),
assume_ssltells Rails to trustX-Forwarded-Protoheaders. Without it,request.protocolreturnshttp://, causing OmniAuth to buildhttp://callback URLs that Keycloak rightfully rejects asinvalid_redirect_uri. This is a well-documented Rails 7.1+ pattern for reverse proxy deployments.Relationship with
force_ssl: Note thatconfig.force_ssl(line 31) remains commented out. This is acceptable --assume_sslhandles protocol detection without forcing HTTPS redirects, which could conflict with the reverse proxy's own TLS termination. The two settings serve different purposes andassume_sslalone is sufficient here.Security: No concerns. This change improves auth correctness without introducing any attack surface. The setting only affects how Rails interprets forwarded headers, which is appropriate for a reverse-proxy deployment.
Test coverage: This is a one-line config uncomment that fixes a production auth flow. There is no new functionality to unit test -- the behavior is validated by the manual test plan (Keycloak login round-trip). The existing OmniAuth callback specs in the test suite cover the auth flow logic itself. No BLOCKER.
BLOCKERS
None.
NITS
production.rbstill has the Rails scaffold defaultconfig.action_mailer.default_url_options = { host: "example.com" }-- not related to this PR, but worth a future cleanup ticket if mailer is ever used.SOP COMPLIANCE
154-enable-assume-ssl-v2follows{issue-number}-{kebab-case-purpose}conventionldraney/landscaping-assistant #154andCloses #154presentPROCESS OBSERVATIONS
VERDICT: APPROVED