change proxypassreverse to custom code

This commit is contained in:
Antonio J. Delgado 2023-11-28 19:41:15 +02:00
parent 089b75e21f
commit 1a0570a495

View file

@ -311,21 +311,21 @@ class mastodon (
require => File["${mastodon_home}/live/.env.production"], require => File["${mastodon_home}/live/.env.production"],
} }
apache::vhost { $hostname: apache::vhost { $hostname:
ensure => $ensure, ensure => $ensure,
access_log_file => $hostname, access_log_file => $hostname,
error_log_file => $hostname, error_log_file => $hostname,
docroot => "${mastodon_home}/live/public", docroot => "${mastodon_home}/live/public",
manage_docroot => false, manage_docroot => false,
proxy_preserve_host => true, proxy_preserve_host => true,
proxy_add_headers => true, proxy_add_headers => true,
port => 443, port => 443,
priority => 15, priority => 15,
protocols => [ protocols => [
'h2', 'h2',
'http/1.1', 'http/1.1',
], ],
protocols_honor_order => true, protocols_honor_order => true,
proxy_pass => [ proxy_pass => [
{ 'path' => '/500.html', 'url' => '!' }, { 'path' => '/500.html', 'url' => '!' },
{ 'path' => '/sw.js', 'url' => '!' }, { 'path' => '/sw.js', 'url' => '!' },
{ 'path' => '/robots.txt', 'url' => '!' }, { 'path' => '/robots.txt', 'url' => '!' },
@ -333,19 +333,21 @@ class mastodon (
{ 'path' => '/browserconfig.xml', 'url' => '!' }, { 'path' => '/browserconfig.xml', 'url' => '!' },
{ 'path' => '/mask-icon.svg', 'url' => '!' }, { 'path' => '/mask-icon.svg', 'url' => '!' },
], ],
proxy_dest_reverse_match => [ custom_fragment => '
{ 'path' => '/api/v1/streaming', 'url' => 'ws://localhost:4000' }, ProxyPass /api/v1/streaming ws://localhost:4000
{ 'path' => '/', 'url' => 'http://localhost:3000/' }, ProxyPassReverse /api/v1/streaming ws://localhost:4000
], ProxyPass / http://localhost:3000/
proxy_pass_match => [ ProxyPassReverse / http://localhost:3000/
',
proxy_pass_match => [
{ 'path' => '^(/.*\.(png|ico)$)', 'url' => '!' }, { 'path' => '^(/.*\.(png|ico)$)', 'url' => '!' },
{ 'path' => '^/(assets|avatars|emoji|headers|packs|sounds|system)', 'url' => '!' }, { 'path' => '^/(assets|avatars|emoji|headers|packs|sounds|system)', 'url' => '!' },
], ],
request_headers => [ request_headers => [
'set X-Forwarded-Proto "https"', 'set X-Forwarded-Proto "https"',
], ],
headers => ['always set Strict-Transport-Security "max-age=31536000"'], headers => ['always set Strict-Transport-Security "max-age=31536000"'],
directories => [ directories => [
{ {
'path' => '^/(assets|avatars|emoji|headers|packs|sounds|system)', 'path' => '^/(assets|avatars|emoji|headers|packs|sounds|system)',
'provider' => 'locationmatch', 'provider' => 'locationmatch',
@ -359,7 +361,7 @@ class mastodon (
'require' => 'all granted', 'require' => 'all granted',
}, },
], ],
error_documents => [ error_documents => [
{ 'error_code' => '500', 'document' => '/500' }, { 'error_code' => '500', 'document' => '/500' },
{ 'error_code' => '501', 'document' => '/501' }, { 'error_code' => '501', 'document' => '/501' },
{ 'error_code' => '502', 'document' => '/502' }, { 'error_code' => '502', 'document' => '/502' },