Skip to content

Commit cf0c4fe

Browse files
authored
Merge pull request #1374 from Shopify/fix-internal-host-api-calls
Fix edge cases for internal hosts
2 parents 013563e + afaf4c4 commit cf0c4fe

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
Note: For changes to the API, see https://shopify.dev/changelog?filter=api
44
## Unreleased
5+
- [#1374](https://github.com/Shopify/shopify-api-ruby/pull/1374) Fix edge cases for Shopify internal hosts
56

67
## 14.9.0
78

lib/shopify_api/auth/oauth.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def validate_auth_callback(cookies:, auth_query:)
111111

112112
sig { params(shop: String).returns(String) }
113113
def auth_base_uri(shop)
114-
return "https://#{shop}/admin" unless defined?(DevServer)
114+
return "https://#{shop}/admin" unless defined?(DevServer) && shop.include?(".my.shop.dev")
115115

116116
# For first-party apps in development only, we leverage DevServer to build the admin base URI
117117
admin_web = T.unsafe(Object.const_get("DevServer")).new("web") # rubocop:disable Sorbet/ConstantsFromStrings

lib/shopify_api/clients/http_client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def serialized_error(response)
131131
def append_first_party_development_headers(headers, parsed_uri)
132132
return headers unless defined?(DevServer)
133133
return headers unless headers["Host"]&.include?(".my.shop.dev") || parsed_uri.host&.include?(".my.shop.dev")
134+
return headers if headers["x-forwarded-host"]&.include?(".my.shop.dev")
134135

135136
# These headers are only used for first party applications in development mode
136137
headers["x-forwarded-host"] = headers["Host"] || parsed_uri.host

0 commit comments

Comments
 (0)