Record of a Cross-Domain Problem, Micro Disk Frontend uniapp, Backend thinkphp

The frontend connects to the API and also uses CDN. I copied solutions from the internet and consulted various AIs. CDN settings:

Response header: Access-Control-Allow-Origin

Value: *

This didn’t work.

Modified the Nginx website configuration file in BT panel:

add_header Access-Control-Allow-Origin *;

add_header Access-Control-Allow-Methods ‘GET,POST’;

add_header Access-Control-Allow-Headers ‘DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization’;

This also didn’t work.

Finally discovered it was because the domain name was too long.

You can all try the methods above once.

2025.4.5

Put the compiled frontend and backend in the same directory. The frontend src can be set to an absolute path: /