My Servers Error Unexpected Token '<',"


Go to solution Solved by dius,

Recommended Posts

After I followed the instructions to update my legacy SSL certificate, I started getting this error and can no longer connect securely to my server.

 

image.png.708b0f9abeac56c447d73a2ba481f2cf.png

 

image.png.d60467e6a09a7e76d564bb643423c79d.png

 

I'm running Unraid 6.11.5.

 

I see some unusual things in my Access Management page now too.

 

Several warnings like this:

 

image.png.d252d0d3c194d8046d3bb48a13e6787d.png

 

When I click on the Learn More link, it just takes me to the Update Your Legacy SSL Certificate Now web page.  I'd like to know where I should look to fix the unexpected token issue.  Any ideas:

 

 

Link to comment

So I've been tweaking things a bit on my server - I no longer have the unsecure access problem.  To fix that all I had to do was set the Use SSL/TLS in Management Access to Strict.  That fixed that issue.

 

As for the initial problem, I'm now seeing a message that says:

JSON.parse: unexpected character at line 1 column 1 of the JSON data.

 

Where can I locate this JSON file that is being parsed so I can find out what is going on?

 

Any ideas?

 

Thanks.

 

Link to comment

The "unexpected token" message means you are accessing the server via a URL that it is not configured to use. I'm excited to say that this error message will be much improved in the next My Servers plugin release.

 

Open a web terminal and run:
  unraid-api report -vv
In the ALLOWED ORIGINS area of the report it will list out the configured urls. I'm guessing you are using a url that is not in that list?

Link to comment
  • Solution

Thanks for the help.  I was able to get everything working.  I did a bit more reading and discovered that I had somehow managed to mess up a couple of settings in the management access settings.  I set the User SSL/TLS to strict and enabled remote access.  I then had to log out of the My Servers a pp, and log back in.  That was the tricky part.  At first it wouldn't let me log out, so I went to the website and logged out there.  Then I was able to log out from my server.  I then logged back in and suddenly everything was working and there were no errors.  A wonder sight to see  for sure.

 

Thanks for your help.  I was able to get it working.  And yes I believe your suggestion was the trigger for me getting it working.  From the look of things, the URLs were correct, but it made me did a little deeper.  Thank goodness for documentation :).

Link to comment

Hi @ljm42, I've got this issue yesterday, too...

I've tried restarting api for several times, and reboot unraid... but not working, either...

Finally, I've reset all devices including fiber gateway, router, switch at the same time, then restart api again, it's back.

I believed that should mostly be caused by dns cache poisoning issues in some places or countries (like country R.P.C. where I am living in).

Link to comment
On 1/11/2023 at 12:30 AM, tomtsang said:

Hi @ljm42, I've got this issue yesterday, too...

I've tried restarting api for several times, and reboot unraid... but not working, either...

Finally, I've reset all devices including fiber gateway, router, switch at the same time, then restart api again, it's back.

I believed that should mostly be caused by dns cache poisoning issues in some places or countries (like country R.P.C. where I am living in).

 

The "unexpected token" message means you are accessing the server via a URL that it is not configured to use. I'm excited to say that this error message will be much improved in the next My Servers plugin release.

 

Open a web terminal and run:
  unraid-api report -vv
In the ALLOWED ORIGINS area of the report it will list out the configured urls. I'm guessing you are using a url that is not in that list?

Link to comment
On 1/12/2023 at 11:58 PM, ljm42 said:

Open a web terminal and run:
  unraid-api report -vv

 

Actually all urls be listed in ALLOWED_ORIGINS are correct, dns cache poisoning issues in my country should be one of the reasons...

 

On 1/11/2023 at 3:30 PM, tomtsang said:

I believed that should mostly be caused by dns cache poisoning issues in some places or countries (like country R.P.C. where I am living in).

 

Unraid-Report.png.5b9067522391daa71edc863e2ac7cf6b.png

Link to comment
5 hours ago, tomtsang said:

Actually all urls be listed in ALLOWED_ORIGINS are correct, dns cache poisoning issues in my country should be one of the reasons...

 

Specifically which of the urls listed in ALLOWED_ORIGINS are you using to access the server? If you can access the server with that url then DNS cache poisoning is not the issue.

 

If you are using a url that is NOT listed in ALLOWED_ORIGINS (such as running through a reverse proxy) then the "unexpected token" error message is normal. Reverse proxies (or accessing via any url not listed in ALLOWED_ORIGINS) are not supported.

Link to comment
13 hours ago, ljm42 said:

running through a reverse proxy

 

I did run through a reverse proxy before, it’s not working stabling then I removed it. But ‘unexpected token’ appeared after I removed it, when I reset the fiber gateway and router, after the public IP changed, My-Server plugin is working fine again, so I thought it might be caused by the dns cache poisoning issue.

Link to comment

And, when I tried to access my unRaid webui via mobile phone data, it works well, but at the same time, ‘unexpected token’ appeared while I was accessing via home networks, before I reset my network devices. That’s why I was wondering if this issue was caused by the dns cache poisoning.

Link to comment
3 hours ago, tomtsang said:

That’s why I was wondering if this issue was caused by the dns cache poisoning.

 

If the URL successfully resolves to your server then it can't be "dns cache poisoning" right? Or maybe I am misunderstanding what you mean by that term.

 

I'm still not clear, are you accessing the server via one of the URLs listed in ALLOWED_ORIGINS, or are you using something else? Please try all of the urls in ALLOWED_ORIGINS, do any of them work without this "unexpected token" message or do they all have that message?

Link to comment

Hi @ljm42,

 

Actually I was about to tell that all the URLs in ALLOWED_ORIGINS are working fine, no matter the localhost or self-own domain or [hash].unraid.net, but when I tried tracert unraid.net, the result told there're some of the dns/nat servers return 'timeout' in China Mainland, such as I access GitHub from my country, it's not working quite well sometimes...

 

I just wanna tell that the problem wasn't caused by My-Server service, in fact, the issue was caused by China Government Firewall protocols. Not sure if someone in other places or countries would meet this the same.

 

Hey, I was not reporting service issues. 😂😂😂 And I appreciate for your patience, too.

Edited by tomtsang
Link to comment
On 1/17/2023 at 2:03 AM, tomtsang said:

Hi @ljm42,

 

Actually I was about to tell that all the URLs in ALLOWED_ORIGINS are working fine, no matter the localhost or self-own domain or [hash].unraid.net, but when I tried tracert unraid.net, the result told there're some of the dns/nat servers return 'timeout' in China Mainland, such as I access GitHub from my country, it's not working quite well sometimes...

 

I just wanna tell that the problem wasn't caused by My-Server service, in fact, the issue was caused by China Government Firewall protocols. Not sure if someone in other places or countries would meet this the same.

 

Hey, I was not reporting service issues. 😂😂😂 And I appreciate for your patience, too.

Same here, mainland China. But I'm using Tailscale for remote access cuz My Servers is not stable. I experienced your same issue AFTER I installed Tailscale. Could be that but I choose to ignore it.

Edited by WeskerYuan
Link to comment