FEATURE: Normalize the service worker route (#12343)

Re-lands the change initially proposed on #8359 but without a new nginx
location block, so it has less change surface.

Co-authored-by: Jeff Wong <awole20@gmail.com>

Co-authored-by: Jeff Wong <awole20@gmail.com>
This commit is contained in:
Rafael dos Santos Silva
2021-05-25 19:39:31 -03:00
committed by GitHub
parent b0b23a969f
commit 9118bb2076
4 changed files with 16 additions and 5 deletions

View File

@ -65,7 +65,12 @@ end
task 'assets:flush_sw' => 'environment' do
begin
# Pending due to test failures.
hostname = Discourse.current_hostname
default_port = SiteSetting.force_https? ? 443 : 80
port = SiteSetting.port.to_i > 0 ? SiteSetting.port : default_port
STDERR.puts "Flushing service worker script"
`curl -s -m 1 --resolve '#{hostname}:#{port}:127.0.0.1' #{Discourse.base_url}/service-worker.js > /dev/null`
STDERR.puts "done"
rescue
STDERR.puts "Warning: unable to flush service worker script"
end