I have a html form that contains some fields to include user credentials and a file input, something like this:
<form action="">
username: <input type="text" name="name" id="name"> <br/>
secret key: <input type="password" name="key" id="key"> <br/>
<input type="file" name="actual_upload" id="actual_upload">
</form>
I want to upload the file to server S2
only after the user credentials has been verified, and a unique token has been generated by another server S1
(returns the token as JSON
).
One way I thought of doing this is posting it to S1
and then forward the request from S1
to S2
. But this way I have to receive the complete request in S1
, which unnecessarily increases S1
's load.
If I put the user credentials in the request header instead of the request body, is there a way to send only the headers to S1
and then after receiving the token, use that to send the file to S2
? Or is there another way?