avatar

axios CROS request two times every time

case: https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Access_control_CORS
header’s param except for the following

  • Accept
  • Accept-Language
  • Content-Language
  • Content-Type (需要注意额外的限制)
  • DPR
  • Downlink
  • Save-Data
  • Viewport-Width
  • Width
    other param make the request become complex requests
javascript
1
// config.headers['X-Token'] = getToken()

here the reason is ‘X-Token’

Author: Qin
Link: https://qinhaolei.com/posts/30125/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.
Reward
  • WechatPay
    WechatPay
  • AliPay
    AliPay
  • Bitcoin
    Bitcoin

Comment