费话不多说直接上代码
add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Headers' 'X-Requested-With, Content-Type'; add_header 'Access-Control-Allow-Credentials' 'true'; add_header 'Access-Control-Allow-Methods' 'OPTION, POST, GET';
打开宝塔的网站配置面板,如图加到所在位置