Axios request Custom Settings header

the backend requires that the header be verified with a sign value when the request is made, and the header information is customized when the request is made. The code is as follows:

clipboard.png

:

clipboard.png

there is an extra Access-Control-Request-Headers:sign
. Someone on the Internet has encountered the same problem as me. The link to this solution: https://codeshelper.com/q/10.;. I asked the background to set it according to the solution, but it still didn"t work. How can I set the header in the form of key-value pairs?

A novice to vue. Please give me some advice. Thank you very much.

Mar.19,2021

this should still be a question of backend settings, that is, about the settings of cors cross-domain backend, there is actually a lot of code on the Internet, but sometimes the specific situation may be slightly different, and you need to co-tune this.


try it:

// Set config defaults when creating the instance
const instance = axios.create({
  baseURL: 'https://api.example.com'
});

// Alter defaults after instance has been created
instance.defaults.headers.common['Authorization'] = AUTH_TOKEN;

axios


Please refer to my article , which is about cross-domain issues. This should be an Option request sent first, but the cross-domain failed due to incorrect cross-domain configuration in the background.


clipboard.png
check to see if Access-Control-Allow-Headers of the response header also has sign


there are two reasons for the problem

  1. Cross-domain
  2. Custom header has been added

the solution is to add the sign field to Access-Control-Request-Headers on the server

.
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-1b372f1-2c088.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-1b372f1-2c088.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?