CORS Policy Annoying Errors

What Cloudflare does for mixed content is make it very easy to cause more problems if you don’t set it up correctly.

What I see on the main.html page is that there is a Javascript fetch() to This URL then redirects to But since that URL is HTTP while you’re on a HTTPS page, browsers block it.

I don’t see any code on your account that could do this. Which means it’s either something on Cloudflare’s side, like Page Rules…

Or the redirect is done by our server to add the slash to the path because it’s a folder. But it uses a HTTP URL because it believes the inbound connection is using HTTP. This can happen if you use Flexible SSL from Cloudflare. To fix this, and improve the security of your site in the process, you could configure your site to use Full SSL instead:

The reason your local site doesn’t have this issue is because you don’t have Cloudflare or HTTPS.

Our hosting isn’t special when it comes to HTTP status codes. I don’t know what your friend experienced that makes them believe that this is a problem, and I would like to know if we have actually been given the chance to help instead of

As for the 403 error, what did you expect? The scripts folder is a folder. There is no index file in that folder, so you’d see a default response. That default response could be directory index, or a 403 error.

If you specifically want to see a directory indexing response, you can enable directory listings by adding a file with the name .htaccess to the scripts directory, with the following contents:

Options +Indexes

I see your code is trying to fetch the directory listing and tries to parse it to extract data. That’s an interesting approach. But please note that we use a custom page template for directory listing, which may not work with your parsing code.

In any case, instead of parsing standard fallback templates from web servers, I would personally just use a little bit of PHP code to gather the data from the file names and wrap those into a JSON response for the frontend code to use. That way, you don’t need to resort to directory listing and regular expressions to gather the data of your files.