简介

<p class="shortdesc"></p> <section class="section" id="Introduction__section_lvx_5tm_nlb"><h2 class="doc-tairway">Obs Endpoint类型</h2> <p class="p"><strong class="ph b">路径类型endpoint</strong></p> <p class="p">内网域名*.cloud.pub类型的endpoint被称为路径类型的endpoint。例如obs-cn-shanghai-internal.cloud.pub是路径类型的endpoint。对于该类型的endpoint,请求中bucket是放到request URI中的。</p> <p class="p">例如一个上传文件的请求:https://obs-cn-shanghai-internal.cloud.pub/<strong class="ph b">mybucket</strong>/mykey</p> <p class="p"><strong class="ph b">五级域名类型endpoint</strong></p> <p class="p">若endpoint为四级域名,且域名为公网域名,则此endpoint为五级域名类型的endpoint。例如endpoint obs-cn-shanghai.yun.pingan.com。此种请求需要在路径类型请求的基础上做修改:需要将bucket从request URI中剔除并移动到host的最前端,且将参数名为bucket的参数从请求中移除(如果有)。</p> <p class="p">例如,对于上传文件的请求https://obs-cn-shanghai.yun.pingan.com/<strong class="ph b">mybucket</strong>/mykey,其五级域名风格:https://<strong class="ph b">mybucket</strong>.obs-cn-shanghai.yun.pingan.com/mykey。</p> </section> <section class="section" id="Introduction__section_ol5_xtm_nlb"><h2 class="doc-tairway">签名生成规则</h2> <p class="p">在Rest请求中,header Authorization生成规则如下:</p> <pre xmlns:version="java:net.sf.saxon.Version" class="pre codeblock language-java">StringToSign = HTTP-Verb + <span class="hl-string" style="color:#2a00ff">"\n"</span> + Content-MD5 + <span class="hl-string" style="color:#2a00ff">"\n"</span> + Content-Type + <span class="hl-string" style="color:#2a00ff">"\n"</span> + Date + <span class="hl-string" style="color:#2a00ff">"\n"</span> + userDefinedMetaHeaders + theRequestResource; Signature = Base64( HMAC-SHA1( secretKey, UTF-<span class="hl-number">8</span> (StringToSign) ) ); Authorization = <span class="hl-string" style="color:#2a00ff">"AWS"</span> + <span class="hl-string" style="color:#2a00ff">" "</span> + AWSAccessKeyId + <span class="hl-string" style="color:#2a00ff">":"</span> + Signature;</pre> <table class="table frame-all" id="Introduction__table_w5t_15m_nlb"><caption></caption><colgroup><col style="width:50%"><col style="width:50%"></colgroup><thead class="thead"> <tr class="row"> <th class="entry" id="Introduction__table_w5t_15m_nlb__entry__1">参数</th> <th class="entry" id="Introduction__table_w5t_15m_nlb__entry__2">说明</th> </tr> </thead><tbody class="tbody"> <tr class="row"> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__1 "> <p class="p">HTTP-Verb</p> </td> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__2 "> <p class="p">请求的动作,如括GET、PUT、DELETE等。</p> </td> </tr> <tr class="row"> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__1 "> <p class="p">\n</p> </td> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__2 "> <p class="p">表示换行符,必须加该字段。</p> </td> </tr> <tr class="row"> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__1 "> <p class="p">Content-MD5</p> </td> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__2 "> <p class="p">表示请求内容数据的MD5值,对消息内容(不包括头部)计算MD5值获得128比特位数字,对该数字进行base64编码而得到。该请求头可用于消息合法性的检查(消息内容是否与发送时一致)</p> <p class="p">如”eB5eJF1ptWaXm4bijSPyxw==”,也可以为空。</p> </td> </tr> <tr class="row"> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__1 "> <p class="p">Content-Type</p> </td> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__2 "> <p class="p">表示请求内容的类型,如”application/octet-stream”,也可以为空。</p> </td> </tr> <tr class="row"> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__1 "> <p class="p">Date</p> </td> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__2 "> <p class="p">请求发起的GMT时间,如Fri, 14 Jul 2017 09:06:22 GMT。</p> </td> </tr> <tr class="row"> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__1 "> <p class="p">userDefinedMetaHeaders</p> </td> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__2 "> <p class="p">用户定义的metadata将被设置到请求的头部。比如,设置一个name为color值为blue的metadata,需要添加一个请求头x-amz-meta-color:blue。此时,userDefinedMetaHeaders为x-amz-meta-color:blue。若有多个自定义的header,则按header name的自然顺序排序。比如,有三个自定义的header分别为width,height,color,则被签名的片段如下:</p> <pre xmlns:version="java:net.sf.saxon.Version" class="pre codeblock language-java">x-amz-meta-color:red x-amz-meta-height:<span class="hl-number">10</span>cm x-amz-meta-width:<span class="hl-number">100</span>cm </pre> </td> </tr> <tr class="row"> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__1 "> <p class="p">theRequestResource</p> </td> <td class="entry" headers="Introduction__table_w5t_15m_nlb__entry__2 "> <p class="p">为请求的URL的uri+[?子资源]+[关键的自然顺序排序的参数name=value]列表。</p> <p class="p">如请求为 http://{host}/{bucket}/{key}?partNumber=1&uploadId=abc</p> <p class="p">则theRequestResource为/{bucket}/{key}?partNumber=1&uploadId=abc</p> </td> </tr> </tbody></table> </section>
Did the above content solve your problem? Yes No
Please complete information!

Call us

400-151-8800

Email us

cloud@pingan.com

Online customer service

Instant reply

Technical Support

cloud products