什么是 Microsoft Azure 中的主机 URI,如何查找?
What is and how do I find the host URI in Microsoft Azure?
在查看 Microsoft 的 REST API 文档时,它表明特定请求的 headers 应包含主机名。我想知道这是什么以及如何找到它?
Microsoft says that these are the request headers:
POST https://testrest.cloudapp.net/api/Channels('nb:chid:UUID:2c30f424-ab90-40c6-ba41-52a993e9d393')/Start HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
x-ms-version: 2.11
Content-Type: application/json;odata=minimalmetadata
Host: <host URI>
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer <token value>
由于收到 400 错误且没有主机 URI,我无法连接。一开始我没有使用它的原因是因为 Postman 没有使用它,但是他们的 API 调用成功了。有谁知道主机 URI 是否是必需的,如果需要,我可以在 Microsoft Azure 中的何处找到它?专门用于媒体服务。
在 Http 1.1 中,主机 header 是必需的。
Http要点:
HTTP/1.0 does not bring host, and HTTP/1.1 adds host head.
Host can be a domain name, or IP, or port number.
Host can be customized by programs. Some programs can define false host in order to prevent operators or bypass firewalls.
Host in HTTP/1.1 can be null value but not without. If no host head is taken, 400 Bad request will be returned.
The HTTP response header does not contain the host field.
Some sites do not check host and can pass arbitrary values.
在Postman中,会自动将hostheader填成URL中的主机(域名)。
对于您的情况,我们可以用 testrest.cloudapp.net:433
填充主机 header
在查看 Microsoft 的 REST API 文档时,它表明特定请求的 headers 应包含主机名。我想知道这是什么以及如何找到它?
Microsoft says that these are the request headers:
POST https://testrest.cloudapp.net/api/Channels('nb:chid:UUID:2c30f424-ab90-40c6-ba41-52a993e9d393')/Start HTTP/1.1
DataServiceVersion: 3.0;NetFx
MaxDataServiceVersion: 3.0;NetFx
Accept: application/json;odata=minimalmetadata
Accept-Charset: UTF-8
x-ms-version: 2.11
Content-Type: application/json;odata=minimalmetadata
Host: <host URI>
User-Agent: Microsoft ADO.NET Data Services
Authorization: Bearer <token value>
由于收到 400 错误且没有主机 URI,我无法连接。一开始我没有使用它的原因是因为 Postman 没有使用它,但是他们的 API 调用成功了。有谁知道主机 URI 是否是必需的,如果需要,我可以在 Microsoft Azure 中的何处找到它?专门用于媒体服务。
在 Http 1.1 中,主机 header 是必需的。
Http要点:
HTTP/1.0 does not bring host, and HTTP/1.1 adds host head.
Host can be a domain name, or IP, or port number.
Host can be customized by programs. Some programs can define false host in order to prevent operators or bypass firewalls.
Host in HTTP/1.1 can be null value but not without. If no host head is taken, 400 Bad request will be returned.
The HTTP response header does not contain the host field.
Some sites do not check host and can pass arbitrary values.
在Postman中,会自动将hostheader填成URL中的主机(域名)。
对于您的情况,我们可以用 testrest.cloudapp.net:433