From 1a0570a4959f088c9762f915a818359e100a8d3b Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Tue, 28 Nov 2023 19:41:15 +0200 Subject: [PATCH] change proxypassreverse to custom code --- manifests/init.pp | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 0f57742..75d1801 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -311,21 +311,21 @@ class mastodon ( require => File["${mastodon_home}/live/.env.production"], } apache::vhost { $hostname: - ensure => $ensure, - access_log_file => $hostname, - error_log_file => $hostname, - docroot => "${mastodon_home}/live/public", - manage_docroot => false, - proxy_preserve_host => true, - proxy_add_headers => true, - port => 443, - priority => 15, - protocols => [ + ensure => $ensure, + access_log_file => $hostname, + error_log_file => $hostname, + docroot => "${mastodon_home}/live/public", + manage_docroot => false, + proxy_preserve_host => true, + proxy_add_headers => true, + port => 443, + priority => 15, + protocols => [ 'h2', 'http/1.1', ], - protocols_honor_order => true, - proxy_pass => [ + protocols_honor_order => true, + proxy_pass => [ { 'path' => '/500.html', 'url' => '!' }, { 'path' => '/sw.js', 'url' => '!' }, { 'path' => '/robots.txt', 'url' => '!' }, @@ -333,19 +333,21 @@ class mastodon ( { 'path' => '/browserconfig.xml', 'url' => '!' }, { 'path' => '/mask-icon.svg', 'url' => '!' }, ], - proxy_dest_reverse_match => [ - { 'path' => '/api/v1/streaming', 'url' => 'ws://localhost:4000' }, - { 'path' => '/', 'url' => 'http://localhost:3000/' }, - ], - proxy_pass_match => [ + custom_fragment => ' + ProxyPass /api/v1/streaming ws://localhost:4000 + ProxyPassReverse /api/v1/streaming ws://localhost:4000 + ProxyPass / http://localhost:3000/ + ProxyPassReverse / http://localhost:3000/ + ', + proxy_pass_match => [ { 'path' => '^(/.*\.(png|ico)$)', 'url' => '!' }, { 'path' => '^/(assets|avatars|emoji|headers|packs|sounds|system)', 'url' => '!' }, ], - request_headers => [ + request_headers => [ 'set X-Forwarded-Proto "https"', ], - headers => ['always set Strict-Transport-Security "max-age=31536000"'], - directories => [ + headers => ['always set Strict-Transport-Security "max-age=31536000"'], + directories => [ { 'path' => '^/(assets|avatars|emoji|headers|packs|sounds|system)', 'provider' => 'locationmatch', @@ -359,7 +361,7 @@ class mastodon ( 'require' => 'all granted', }, ], - error_documents => [ + error_documents => [ { 'error_code' => '500', 'document' => '/500' }, { 'error_code' => '501', 'document' => '/501' }, { 'error_code' => '502', 'document' => '/502' },