Home > Topics > Pagoda Panel > How to solve cross-domain problems in Pagoda Linux panel

How to solve cross-domain problems in Pagoda Linux panel

藏色散人
Release: 2021-03-04 11:35:56
forward
11053 people have browsed it

The following tutorial column of Pagoda will introduce to you the Pagoda Linux panel to solve cross-domain problems. I hope it will be helpful to friends in need!

How to solve cross-domain problems in Pagoda Linux panel

First about cross-domain What is https://baike.baidu.com/item/...
The Pagoda Linux panel is a server panel that is relatively friendly to novices, but it cannot avoid some common server problems such as cross-domain problems:
Website》Select Website》Configuration File
Solution

add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
Copy after login

Go to this page and paste the above code at the bottom, and then restart the server
How to solve cross-domain problems in Pagoda Linux panel

Here is a json data of prepared music that can be tested
http://101.200.141.4/api/musi...

juqery:
$.ajax({
    type: "get",
    url: "http://101.200.141.4/api/music.json",
    success: function (response) {
        console.log(response.name);
        console.table(response.data);
    }
});
在vue中可以安装vue-axios进行请求
Copy after login

The above is the detailed content of How to solve cross-domain problems in Pagoda Linux panel. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template