0

I sent a "put" request and received a cors issue:

enter image description here

This is the payload header:

enter image description here

enter image description here

I sure it's not a header issue and checked with my backend engineer. He says gcp upload (google cloud platform) needs xml formatted request(XHR). And I found axios' default is the JSON format.

Then I tried to find some workable solution like sending formData as payload.

How to send a file via Axios to Laravel

But it still doesn't work. Is there any sample of sending xml format request with vue axios?

If not, I have to turn back to use "new XMLHttpRequest();".

Thanks

KevinHu
  • 991
  • 3
  • 10
  • 20
  • Cross-origin PUT requests *always* trigger a preflight. – Quentin Jan 30 '18 at 08:51
  • Can it be resolved by client site which set header in axios? (I have try to send header like "Access-Control-Allow-Origin" and backend engineer say he already set.) Or It can't use by axios to send request? – KevinHu Jan 30 '18 at 08:59
  • Access-Control-Allow-Origin is a response header, not a request header. The server has to give your JS permission. It can't give itself permission. – Quentin Jan 30 '18 at 09:00
  • You're right, sorry I mean setting "Content-Type" and backend site is already set. So it can't resolve by axios ? Should I use "new XMLHttpRequest()" ..? – KevinHu Jan 30 '18 at 09:02
  • Here is some information: I'm not sure can axios sending request to gcp upload? https://stackoverflow.com/questions/44705528/google-cloud-storage-ignoring-access-control-origin-headers – KevinHu Jan 30 '18 at 09:22

0 Answers0