Wood Chen

Allow Cross-Origin Requests in Apple CMS

0 comments134 views47 words

This post was translated from Chinese by AI. If anything reads oddly, the Chinese original is authoritative. 中文原文

This article is excerpted from: https://78.al/index.php/post/34.html
Just keeping a backup for myself.

Open the Apple CMS site and find the following file:

application/api/controller/Provide.php

Add the following code in the appropriate location:

Allow specific domains

$origin = isset($_SERVER['HTTP_ORIGIN'])? $_SERVER['HTTP_ORIGIN'] : '';  
// List the domains allowed to make cross-origin requests in the array,
$allow_origin = array('http://xxx.com','http://xxx.cn'  );   
if(in_array($origin, $allow_origin)){ 
    header('Access-Control-Allow-Origin:'.$origin);   
}

Allow everyone

Last updated 2024-01-14

Related posts

Comments 0