CORS Policy Annoying Errors

Website URL

https://stellarhub.xyz

Error Message

main:1 Mixed Content: The page at ‘stellarhub.xyz/main’ was loaded over HTTPS, but requested an insecure resource ‘stellarhub.xyz/scripts/’. This content should also be served over HTTPS.
main:1 Access to fetch at stellarhub.xyz/scripts/’ (redirected from ‘stellarhub.xyz/scripts’) from origin ‘stellarhub.xyz’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header has a value ‘https://stellarhub.xyz’ that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
scripts/:1

    Failed to load resource: net::ERR_FAILED

main:47 Failed to fetch scripts directory: TypeError: Failed to fetch
(anonymous) @ main:47

(other information and details relevant to your question)

Ehm, I tried to make a website that you can store scripts using text files, So I made a system where all the files in this folder called /scripts are gonna show up in a design. It works on the local server but not when I try using it on Infinity Free. Please help.

Did you do this?

3 Likes

Yea but, that’s cloudflare’s thing. Cloudflare does that for me. Also, that’s not just the problem. There’s multiple problems.

This may help

1 Like

http://stellarhub.xyz/scripts/ redirects me to InfinityFree’s 403 page. It seems that your code is also unable to access it, which is why it gives a warning.

This is likely a code issue, and since your JS is obfuscated, we cannot see it so we cannot try to help you. You’ll have to find out what’s going wrong there.
If the folder is meant to be publicly accessible then this could also be the issue, make sure that the permissions are set up correctly and that access is not denied.

2 Likes

Hm, yes it says the 403 Forbidden error. But the local site can read it perfectly fine but InfinityFree can’t? my friend also told me InfinityFree has a a lot of issues in these stuff.

Did you read the article above? Did you check that access to the folder isn’t blocked by some .htaccess directive, or something else?

I don’t think the ‘scripts’ keyword for a folder is banned since it isn’t mentioned in the article, but you can try copying and pasting the contents to a new folder with a different name (even ‘temp’ would do I suppose) and see if it can be accessed. If not, something’s wrong with your configuration.

Or, once again if the folder isn’t meant to be accessed by the public, check with your configuration to ensure that the script looking for it can. We can’t help you without more information.

1 Like

It’s InfinityFree. My friend told me InfinityFree has a lot of problems in this kind of stuff. He uses the same method and it perfectly works on iFastNet. Is there any solution for this bug? Also what do you mean by

“Something’s wrong with your configuration”?

I just uploaded my whole HTML website stuff in the file manager using FileZilla. As I said earlier, it works in the local server (Client or local server both works) but not in InfinityFree.

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 https://stellarhub.xyz/scripts. This URL then redirects to http://stellarhub.xyz/scripts/. 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.

3 Likes

I have removed cloudflare for my website and all of that stuff.

Now this is what I get;

rs.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%209.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%209.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%209.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%209.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%208.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%208.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%208.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%208.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%207.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%207.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%207.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%207.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%206.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%206.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%206.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%206.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%205.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%205.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%205.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%205.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%204.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%204.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%203.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%203.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%204.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%204.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%203.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%203.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%202.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%202.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140
main.html:1 Access to fetch at ‘https://errors.infinityfree.net/errors/404/’ (redirected from ‘https://stellarhub.xyz/owlhub%20copy%202.txt’) from origin ‘https://stellarhub.xyz’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
errors.infinityfree.net/errors/404/:1

    Failed to load resource: net::ERR_FAILED

main.html:140 Failed to fetch owlhub%20copy%202.txt: TypeError: Failed to fetch
(anonymous) @ main.html:140

although these errors disappear if I turn on allow CORS policy extension, but only the 404 errors popup.But normally the user who visits it wouldn’t have that turned on or even have it so what am I suppose to do?

The missing files are redirecting to InfinityFree’s 404 page, which cannot be loaded on your site because of CORS, thus the error.

3 Likes

The TXT files were inside the scripts folder last time I checked. So the URL should be https://stellarhub.xyz/scripts/owlhub.txt, not https://stellarhub.xyz/owlhub.txt. Please check your code to make sure that the correct URL is used.

4 Likes

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