Browse Source

Fixes #3679 - Zendesk URL check fails with Net::HTTPForbidden 403 error.

Thorsten Eckel 3 years ago
parent
commit
e9a442160b
1 changed files with 2 additions and 3 deletions
  1. 2 3
      app/controllers/import_zendesk_controller.rb

+ 2 - 3
app/controllers/import_zendesk_controller.rb

@@ -23,7 +23,7 @@ class ImportZendeskController < ApplicationController
       'Connection refused'                                        => 'Connection refused!',
     }
 
-    response = UserAgent.request(params[:url], verify_ssl: true)
+    response = UserAgent.request(URI.join(params[:url], '/api/v2/users/me').to_s, verify_ssl: true)
 
     if !response.success?
       message_human = ''
@@ -40,8 +40,7 @@ class ImportZendeskController < ApplicationController
       return
     end
 
-    # since 2016-10-15 a redirect to a marketing page has been implemented
-    if response.body.exclude?(params[:url])
+    if response.header['x-zendesk-api-version'].blank?
       render json: {
         result:        'invalid',
         message_human: 'Hostname not found!',