什么是?如何在Microsoft Azure中找到主机URI?

时间:2018-07-03 17:52:05

标签: azure http-headers postman azure-media-services

查看Microsoft的REST API文档时,它显示特定请求的标头应包含主机名。我想知道这是什么以及如何找到它?

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中找到它吗?专门用于媒体服务。

1 个答案:

答案 0 :(得分:1)

在Http 1.1中,需要Host标头。

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中,它将使用URL中的主机(域名)自动填充主机头。

在您的情况下,我们可以用testrest.cloudapp.net:433填充主机标头