docs: clarrify use of sw behind redirect (#32915)
Closes #30684 PR Close #32915
This commit is contained in:
		
							parent
							
								
									427a1ccd9a
								
							
						
					
					
						commit
						ec482dadb1
					
				@ -344,6 +344,24 @@ This script can be used both to deactivate `@angular/service-worker`
 | 
			
		||||
as well as any other Service Workers which might have been served in
 | 
			
		||||
the past on your site.
 | 
			
		||||
 | 
			
		||||
### Changing your app's location
 | 
			
		||||
 | 
			
		||||
It is important to note that service workers don't work behind redirect. You 
 | 
			
		||||
may have already encountered the error `The script resource is behind a redirect, which is disallowed`.
 | 
			
		||||
 | 
			
		||||
This can be a problem if you have to change your app's location. If you setup 
 | 
			
		||||
a redirect from the old location (for example `example.com`) to the new 
 | 
			
		||||
location (for example `www.example.com`) the worker will stop working. 
 | 
			
		||||
Also, the redirect won't even trigger for users who are loading the site 
 | 
			
		||||
entirely from Service Worker. The old worker (registered at `example.com`)
 | 
			
		||||
 tries to update and sends requests to the old location `example.com` which 
 | 
			
		||||
 get redirected to the new location `www.example.com` and create the error 
 | 
			
		||||
`The script resource is behind a redirect, which is disallowed`.
 | 
			
		||||
 | 
			
		||||
To remedy this, you may need to kill the old worker using one of the above
 | 
			
		||||
techniques ([Fail-safe](#fail-safe) or [Safety Worker](#safety-worker)).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## More on Angular service workers
 | 
			
		||||
 | 
			
		||||
You may also be interested in the following:
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user