How can I access api.example.com at www.example.com

Username epiz_32092852

epiz_32092852

nnjz.ml

Error Message

Access to XMLHttpRequest at ‘https://api.nnjz.ml/getBaseInfo’ from origin ‘https://nnjz.ml’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Other Information


So can I access https://api.nnjz.ml at https://www.nnjz.ml (or https://nnjz.ml)?

I’m not a native English speaker, so please excuse my grammar mistakes

InfinityFree is a webhosting company, not an API host.

6 Likes

I know, but https://nnjz.ml is also hosted by infinityfree

I just want to separate PHP files from HTML files

CORS must be used from the same domain. So if you have an api that you intend to use, you must keep it on the same domain or set up CORS correctly.

6 Likes

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