After updating Sonarr, loading gives blank page with console complaining about "urlBase"

Sonarr version (exact version): 3.0.10.1567
Mono version (if Sonarr is not running on Windows): 6.12.0.182
OS: Linux
Debug logs: [Info] Auth: Auth-Unauthorized ip xx.xx.xx.xx url 'http://sonarr.my.domain/initialize.js'
Description of issue:

I’ve had Sonarr working for years, but after updating to some more recent version, opening Sonarr now gives just a blank page. The console errors I’m getting when this happens:

[Error] SyntaxError: Unexpected token '<'
	(anonymous function)
[Error] TypeError: undefined is not an object (evaluating 'window.Sonarr.urlBase')
	39347 (index.js:1:1104167)
	r (index.js:1:1111696)
	26023 (index.js:1:35887)
	r (index.js:1:1111696)
	(anonymous function) (index.js:1:1113537)
	(anonymous function) (index.js:1:1112079)
	(anonymous function) (index.js:1:1113553)
	Global Code (index.js:1:1113557))

and on the server side, even with Trace logging on, all I get is this:

[Info] Auth: Auth-Unauthorized ip xx.xx.xx.xx url 'http://sonarr.my.domain/initialize.js' 

and the access logs look normal:

(25/Jun/2023:14:48:11 -0500) xx.xx.xx.xx (:49651) -> GET https://sonarr.my.domain/ HTTP/1.1 -> Code 200. Sent 902 bytes. Referred by -. Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15".
xx.xx.xx.xx - - [25/Jun/2023:14:48:11 -0500] "GET /initialize.js HTTP/1.1" 303 0 "https://sonarr.my.domain/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15"
(25/Jun/2023:14:48:11 -0500) xx.xx.xx.xx (:49651) -> GET https://sonarr.my.domain/initialize.js HTTP/1.1 -> Code 303. Sent 0 bytes. Referred by https://sonarr.my.domain/. Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15".
xx.xx.xx.xx - - [25/Jun/2023:14:48:11 -0500] "GET /login?returnUrl=/initialize.js HTTP/1.1" 200 2341 "https://sonarr.my.domain/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15"
(25/Jun/2023:14:48:11 -0500) xx.xx.xx.xx (:49651) -> GET https://sonarr.my.domain/login?returnUrl=/initialize.js HTTP/1.1 -> Code 200. Sent 2341 bytes. Referred by https://sonarr.my.domain/. Agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.5 Safari/605.1.15".

If I reload the page exactly 3 times, on the 3rd time, it will load. On the iPhone (homepage web app), however, this is not possible so it never loads. Sometimes I will get lucky. I use a reverse proxy. My “URL Base” setting is blank because it’s supposed to be blank.

This would happen if the request for initalize.js was not authenticated, which appears to be the case there, perhaps the auth header or cookie (depending on auth type) is being dropped by your reverse proxy or for some reason your browser isn’t sending it?

Does it work if you bypass the reverse proxy?
Which browser are you using?
Which reverse proxy are you using?

It does seem to work if I bypass the reverse proxy. I’m using Nginx. The browser is Safari on both desktop and mobile. The Nginx settings are these (they were working for 3+ years):

server {
  server_name sonarr.my.domain;
  set $server http://sonarr:8989;                                                                                                                            
                                                                                                                                                             
  listen 443 ssl;                                                                                                                                            
  include /config/nginx/ssl.conf;                                                                                                                            
                                                                                                                                                             
  location / {
    include /config/nginx/proxy.conf;
    proxy_pass $server;

    resolver 127.0.0.11 valid=30s;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $http_connection;
  }
}

The only thing I see missing is the headers that would allow Sonarr to see the original request, but those may be filled in automatically via other config (this like Host, X-Forwarded-Host, etc).

We haven’t made any recent changes to how Sonarr behaves in regards to reverse proxies, but maybe Safari has made a change that affects things (best guess is something with a cookie mismatch).

Yeah I just tried every reverse proxy header in existence but haven’t been able to fix this. For desktop Safari, I can always just refresh twice and it works, but the iOS Home Screen web app is broken with no workaround

Have you tried a different browser (e.g. Firefox) on MacOS?

Feel free to try on iOS as well, but they’re all just WebKit (for now anyways), so may not make a difference.

Chromium on Mac seems to not have this problem so far, just Safari

I had the exact same issue.

The root cause was cached credentials. Clearing the Safari cache solved this.

IOS:
Settings > Safari > Advanced > Website Data or
Settings > Safari > Clear History and Website Data

This worked for the first “session” but upon the second one, went back to the blank page. Also doesn’t seem to affect the iOS home page PWAs

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.