Skip to content

Commit

Permalink
Merge pull request #43 from guardian/an/force-https-downloads
Browse files Browse the repository at this point in the history
Forcibly upgrade all downloads to HTTPS
  • Loading branch information
andrew-nowak authored Aug 21, 2024
2 parents 65b1e66 + 2f01ee9 commit 560b251
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion associated-press/app/client/HttpClient.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ object HttpClient {
headers: Seq[(String, String)] = Seq.empty,
parameters: Seq[(String, String)] = Seq.empty
): Future[StandaloneWSResponse] = {
ws.url(uri)
// on the CODE env, the preview feed will return HTTP S3 URLs, but our
// security group only allows outbound requests on port 443...
// force all the URIs to HTTPS to allow the requests to complete.
val forcedHttps = uri.replaceAll("^http://", "https://")
ws.url(forcedHttps)
.addHttpHeaders(headers: _*)
.addQueryStringParameters(parameters: _*)
.get()
Expand Down

0 comments on commit 560b251

Please sign in to comment.