ApRequestService: don't generate our own Host header (#9378)
This commit is contained in:
		
							parent
							
								
									fe98ad8849
								
							
						
					
					
						commit
						3feaf39294
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		|  | @ -57,7 +57,7 @@ export class ApRequestService { | ||||||
| 			method: 'POST', | 			method: 'POST', | ||||||
| 			headers: this.objectAssignWithLcKey({ | 			headers: this.objectAssignWithLcKey({ | ||||||
| 				'Date': new Date().toUTCString(), | 				'Date': new Date().toUTCString(), | ||||||
| 				'Host': u.hostname, | 				'Host': u.host, | ||||||
| 				'Content-Type': 'application/activity+json', | 				'Content-Type': 'application/activity+json', | ||||||
| 				'Digest': digestHeader, | 				'Digest': digestHeader, | ||||||
| 			}, args.additionalHeaders), | 			}, args.additionalHeaders), | ||||||
|  | @ -83,7 +83,7 @@ export class ApRequestService { | ||||||
| 			headers: this.objectAssignWithLcKey({ | 			headers: this.objectAssignWithLcKey({ | ||||||
| 				'Accept': 'application/activity+json, application/ld+json', | 				'Accept': 'application/activity+json, application/ld+json', | ||||||
| 				'Date': new Date().toUTCString(), | 				'Date': new Date().toUTCString(), | ||||||
| 				'Host': new URL(args.url).hostname, | 				'Host': new URL(args.url).host, | ||||||
| 			}, args.additionalHeaders), | 			}, args.additionalHeaders), | ||||||
| 		}; | 		}; | ||||||
| 
 | 
 | ||||||
|  | @ -106,6 +106,8 @@ export class ApRequestService { | ||||||
| 		request.headers = this.objectAssignWithLcKey(request.headers, { | 		request.headers = this.objectAssignWithLcKey(request.headers, { | ||||||
| 			Signature: signatureHeader, | 			Signature: signatureHeader, | ||||||
| 		}); | 		}); | ||||||
|  | 		// node-fetch will generate this for us. if we keep 'Host', it won't change with redirects!
 | ||||||
|  | 		delete request.headers['host']; | ||||||
| 
 | 
 | ||||||
| 		return { | 		return { | ||||||
| 			request, | 			request, | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue