Halite Leaderboard and Watch page doesn't load on first visit


#1

I noticed if you are not logged in, the first time you visit halite.io and you click on “Leaderboard” or “watch”, the contents of the page remain blank. Only after you log in does it begin to load reliably

To reproduce, I visit halite.io in an incognito window or new browser that I don’t usually use and click on Watch or Leaderboard.


#2

Interesting. Is there anything in the JavaScript console? (Control-Shift-J or Command-Shift-J)


#3

Yes, it seems when it fails to load for me, I see this error:

Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
js.hs-analytics.net/analytics/1543591200000/4655853.js:1 Failed to load resource: net::ERR_BLOCKED_BY_CLIENT
utils.js:26 init profile
programming-competition-leaderboard:1 Access to XMLHttpRequest at 'https://api.2018.halite.io/v1/login/me' from origin 'https://www.halite.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
programming-competition-leaderboard:1 Access to XMLHttpRequest at 'https://api.2018.halite.io/v1/api/leaderboard?offset=0&limit=999999' from origin 'https://www.halite.io' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Maybe something about the Access-Control-Allow-Origin header?


#4

Hey, really sorry about the delay here. Yes, looks like Chrome is blocking the first request, though why I can’t say. Does it report anything else (404 or 500 or something)? The header should always be there unless it’s a 404 page…


#5

Hey no problem. Looking at my network logs, I don’t have any 404/500 errors.

However, I think I figured out a way to actually reproduce the problem. I realized the problem only occurs for me because I usually visit halite.io through the Chrome recently-visited links. I noticed if I just visit the halite website normally everything works fine.

When you open a new tab in Chrome, it will show you buttons for your recently visited pages like this:

For me, halite.io is one of my recently-visited sites. If I visit halite.io through clicking on one of those buttons, I get the CORS header error. And this same thing happens if I try on Firefox as well.

My guess is that the origin header is probably set differently if one visits the website through clicking on a link through the Chrome new tab. That might be the source of the problem. Let me know if this reproduces the issue for you.

EDIT: I tried it out on my laptop, and I actually can’t reproduce the problem anymore. Maybe there is some other underlying cause; if others aren’t experiencing this then it might just be something weird on my end.


#6

Hmm, that’s a potential lead, but if it doesn’t reproduce it then not sure that’s the issue.