Cross-domain problems of local development of WEB projects separated from front and rear ends

Development environment: MAC OS, APACHE, PHP7.2, ThinkPHP5, vue.js 3.0, axios.

the back-end interface is developed by ThinkPHP5, and cross-domain headers have been added to return the data. Deployed on the local IP:192.168.0.3:80.
the data returned by the interface can be accessed through POSTMAN.

clipboard.png

clipboard.png

HEADER
clipboard.png

vue-cli192.168.0.3:8080:

clipboard.png

how should I set up cross-domain in this case? I have no experience. I messed up all night and didn"t get it done at 5 o"clock this morning. no, no, no. Anxious, please have a lot of advice from experienced friends, thank you!

May.14,2021

you've already used cli. Why don't you use the proxy agent?


that specializes in solving this kind of problem. There are proxy settings in

vue-cli .
but! If you're afraid of trouble, don't say anything. Why don't you try this, once and for all.
is probably the simplest and roughest way to solve cross-domain problems in the Eastern Hemisphere :
1. chrome copy shortcuts.
2. Right-click the shortcut and change the property-destination
to the following (make sure these installation paths exist)

"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --disable-web-security --user-data-dir=C:\Program Files (x86)\Google\Chrome\Application

3. Advantages: you can even debug the online interface on the local page.


now in the development stage, let the backend program open cross-domain and solve the problem of hanging Access-Control-Allow-Origin (the error prompted by console, you should have sent a post request, but it is a complex request. The browser sends a request of OPTIONS type, but the backend does not process this type of request). It is not recommended to use jsonp to solve


or nginx


.
const APIS = [
    '/api/'
]
const target = ''

const onProxyReq = proxyReq => {}
module.exports = APIS.reduce((result, curr) => {
    result[curr] = {
        target,
        onProxyReq,
        changeOrigin: true
    }
    return result
}, {})

then configure proxyTable in config ~

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eae856-47fa3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eae856-47fa3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?