Forum Discussion

XuSteve_371030's avatar
XuSteve_371030
Icon for Nimbostratus rankNimbostratus
Sep 20, 2018

400 When uploading a file using /mgmt/shared/file-transfer/uploads

When uploading a CERT file using /mgmt/shared/file-transfer/uploads. There are two responses from the server:

We are completely uploaded and fine
[5 bytes data]
< HTTP/1.1 400 Bad Request
...
< Connection: close
{ [5 bytes data]
100  2200  100  1100  100  1100   1639   1639 --:--:-- --:--:-- --:--:--  1676-----BEGIN CERTIFICATE-----
...

However, the file indeed not getting uploaded to the server! Any help?

  • { [5 bytes data]
    

    < HTTP/1.1 400 Bad Request < Date: 20 Sep 2018 20:52:59 UTC < Server: < Set-Cookie: BIGIPAuthCookie=325F665C8BCA34EE3D2DA7970D1FC57804A7D675; path=/; Secure; HttpOnly < Set-Cookie: BIGIPAuthUsernameCookie=admin; path=/; Secure; HttpOnly < X-Frame-Options: SAMEORIGIN < Strict-Transport-Security: max-age=16070400; includeSubDomains < Pragma: no-cache < Cache-Control: no-store, no-cache, must-revalidate < Expires: -1 < Content-Length: 86 < Content-Type: application/octet-stream < Content-Range: 0-86/86 < REMOTEROLE: 0 < Local-Ip-From-Httpd: 10.0.2.15 < X-Forwarded-Server: localhost.localdomain < X-Forwarded-Proto: http < REMOTECONSOLE: /usr/bin/tmsh < X-Forwarded-Host: denac475.us.oracle.com:8443 < X-Content-Type-Options: nosniff < X-XSS-Protection: 1; mode=block < Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' http://127.4.1.1 http://127.4.2.1 < Connection: close < { [5 bytes data]

  • Hi,

    Did you remember to set header "Content-Range" and value?

    If not, this is probably the main cause.

    e.g.

    filename=certfile.crt
    filesize=$(stat -c%s "$filename")
    curl -kv -u admin:admin -X POST -H "Content-Type: application/octet-stream" -H "Content-Range: 0-$[filesize-1]/$filesize" --data-binary "@$filename" https://192.168.1.245/mgmt/shared/file-transfer/uploads/$filename | json-format
    

    Regards.