Chrome throwing cross-origin error on apache test server, but works fine in Firefox

javascript
pixijs

#1

I’m trying to write a simple pixijs application, and when I run it from the built in apache server it works fine on Firefox, but in Chrome it doesn’t run or load any animations. In the developer console, I get:

Redirect at origin ‘https://c9users.io’ has been blocked from loading by Cross-Origin Resource Sharing policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘https://MYWORKSPACEHERE.c9users.io’ is therefore not allowed access.

This happens even if I change https to http. The redirect error itself is highlighting the doctype declaration at the very top of index.html.


#2

Hey @FakeRobotGamer :slightly_smiling:,

Have you happened to have seen this prior topic on the issue:

:book: :snail:


#3

Yes, I saw this thread, however it does not resolve my issue.

This is a very simple application that just does standard, relative-path includes, of plain HTML, CSS, and Javascript.


#4

Can’t think of why this might be happening off the top of my head but can you try it in incognito mode to make sure it’s not an extension that’s breaking it?


#5

This is happening because pixi.js loads your assets on the fly from your server. Unfortunately it loads them in a way that doesn’t pass authentication cookies to the server so when the request goes to Cloud9 Cloud9 sends back a login page (as it doesn’t know that asset request is authenticated).

The only way I’ve found to fix this is to set your application preview to public. Then you don’t need authentication to view your site so it can retrieve all the assets correctly.