diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2020-04-25 22:01:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-25 22:01:08 +0200 |
commit | 2744f61696df70e722cd6ade9564ad4f0f8f34d6 (patch) | |
tree | 0ac14794c172b692330ac2c7dadbb29037211724 /app/services | |
parent | be637146f310d7ec3a49d01e850959514e9e4964 (diff) |
Fix not being able to resolve public resources in development environment (#13505)
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/fetch_resource_service.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/app/services/fetch_resource_service.rb b/app/services/fetch_resource_service.rb index 880cdde92..6c0093cd4 100644 --- a/app/services/fetch_resource_service.rb +++ b/app/services/fetch_resource_service.rb @@ -25,7 +25,18 @@ class FetchResourceService < BaseService end def perform_request(&block) - Request.new(:get, @url).add_headers('Accept' => ACCEPT_HEADER).on_behalf_of(Account.representative).perform(&block) + Request.new(:get, @url).tap do |request| + request.add_headers('Accept' => ACCEPT_HEADER) + + # In a real setting we want to sign all outgoing requests, + # in case the remote server has secure mode enabled and requires + # authentication on all resources. However, during development, + # sending request signatures with an inaccessible host is useless + # and prevents even public resources from being fetched, so + # don't do it + + request.on_behalf_of(Account.representative) unless Rails.env.development? + end.perform(&block) end def process_response(response, terminal = false) |