Jdor300
Contributor
Contributor

Can't upload file with PUT to ESXi from AJAX request

We have a website that allows to clients upload files to VM's.

How it's done:

     The user drop a file to drap and drop zone, then we send minimal information about the file (name,size) to the back-end.

     The back-end server generate URL with pyvmomi (InitiateFileTransferToGuest) and send it back to the browser.

     Then with jquery AJAX request we try to PUT the content of the file to the given URL.

    

And we get this exception:

     "OPTIONS http://x.x.x.x/guestFile?id=xxx&token=xxxxxxxxxxxx" 501 (Not Implemented)

     and "... No 'Access-Control-Allow-Origin' header is present on the requested resource ..."

In other words, there is no CORS allowed in the ESXi, and the browser must to send "preflight request" before he send PUT.

I searched the whole ESXi and the internet (for sure I missing something), how to allow OPTIONS in the ESXi too ...

Please guys it is very urgent, can someone help here ?

Tags (3)
0 Kudos
0 Replies