mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 19:01:54 +00:00
Mastodon 4.6.2 derives https = Rails.env.production? in 1_hosts.rb. The HTTP-only override disabled force_ssl and the route defaults, but config.x.use_https, the streaming base URL and the ActionMailer default_url_options kept https and wss. RoutingHelper#default_url_options delegates to the ActionMailer hash, so an onion deployment still handed out https avatar URLs and a wss streaming endpoint that nothing serves. The override now sets use_https to false, points streaming at ws://<web_domain> and merges protocol http:// into the mailer defaults once ActionMailer loads. The block stays gated on MASTODON_HTTP_ONLY_ENABLED, which is true only when TLS is disabled for the role, so HTTPS deployments are untouched. Measured on the mastodon v4.6.2 image: without the override use_https is true and streaming is wss; with it both switch to http and ws. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
34 lines
1.4 KiB
YAML
34 lines
1.4 KiB
YAML
---
|
|
- name: "📦 MASTODON | Install HTTP-only override initializers"
|
|
when: MASTODON_HTTP_ONLY_ENABLED | bool
|
|
block:
|
|
- name: "✅ MASTODON | Ensure overrides directory exists"
|
|
ansible.builtin.file:
|
|
path: "{{ MASTODON_OVERRIDES_DIR }}"
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: "📦 MASTODON | Install force_ssl override initializer (HTTP-only)"
|
|
ansible.builtin.copy:
|
|
dest: "{{ MASTODON_FORCE_SSL_OVERRIDE_FILE }}"
|
|
mode: "0644"
|
|
content: |
|
|
# frozen_string_literal: true
|
|
|
|
Rails.application.config.force_ssl = false
|
|
Rails.application.config.middleware.delete ActionDispatch::SSL if defined?(ActionDispatch::SSL)
|
|
Rails.application.routes.default_url_options[:protocol] = "http"
|
|
Rails.application.config.x.use_https = false
|
|
Rails.application.config.x.streaming_api_base_url = "ws://#{Rails.application.config.x.web_domain}"
|
|
ActiveSupport.on_load(:action_mailer) do
|
|
self.default_url_options = default_url_options.merge(protocol: "http://")
|
|
end
|
|
notify: compose-up
|
|
|
|
- name: "📦 MASTODON | Install OIDC http-discovery override initializer (HTTP-only)"
|
|
ansible.builtin.copy:
|
|
src: "ruby/00_oidc_http_discovery.rb"
|
|
dest: "{{ MASTODON_OIDC_HTTP_DISCOVERY_FILE }}"
|
|
mode: "0644"
|
|
notify: compose-up
|