Linux curl post request and Error 417 but sudo success? -
my service deployed in docker,the exposed nginx port 18082;service port 38087,and tried both.
while use command
curl -i -x post -h 'content-type: text/json' -d @post.json \ http://127.0.0.1:18082/youtu/openliveapi/livedetectfour
return 417
http/1.1 417 expectation failed server: squid/2.7.stable9 date: tue, 15 aug 2017 11:57:04 gmt content-type: text/html content-length: 1436 x-squid-error: err_invalid_req 0 x-cache: miss sk-squiddev-118 x-cache-lookup: none sk-squiddev-118:8080 connection: close but when add sudo in front,it return success. http/1.1 100 continue http/1.1 200 ok server: openresty/1.9.15.1
i search , knew while curl post on 1024 bytes,it first send
expect 100-continue.if server don't support request, return 417 error.
then how can sudo succsess,maybe related nginx mechanism,i'm not familiar that.thanks.
since using proxy in corporate setup , proxy might insert in user's bash profile. can 3 things
update ~/.bash_profile or ~/.bashrc
remove proxy profile , won't need proxy
unset variables
you can unset variables before call
unset http_proxy unset https_proxy curl -i -x post -h 'content-type: text/json' -d @post.json \ http://127.0.0.1:18082/youtu/openliveapi/livedetectfour blank variables call
you can set variables 1 curl call
http_proxy= https_proxy= curl -i -x post -h 'content-type: text/json' -d @post.json \ http://127.0.0.1:18082/youtu/openliveapi/livedetectfour
Comments
Post a Comment