Updating App and callback URL from localhost to actual url is not working

Topic summary

A developer is experiencing issues after migrating their Shopify app from localhost to a production domain. Despite updating the app URLs and callback URL in the Shopify Partner Dashboard, the OAuth redirect still points to localhost instead of the new domain.

Technical Setup:

  • Built using Ruby with the shopify_app gem
  • Updated ENV['HOST'] to the actual domain and restarted the server
  • Configuration includes ShopifyAPI::Context.setup with proper API credentials

Current Problem:
The redirect URI in the OAuth authorization flow remains hardcoded to localhost (visible in the authorization URL parameters), even after configuration changes.

Suggested Solution:
A support team member advised that URL changes must be made in the code itself, not just environment variables. Specifically, the redirect URI passed to the Shopify API during authentication token generation or charge creation needs to be explicitly updated in the codebase.

Status: The issue remains unresolved, with the developer seeking guidance on how to properly override the redirect behavior in the shopify_app gem configuration.

Summarized with AI on November 24. AI used: claude-sonnet-4-5-20250929.

I have updated the app urls and callback url for my existing app. Before the url is localhost, but now I have hosted in in a cloud server and assigned a domain and updated this domain in the app url and callback url. But when i am trying to install app from app overview page, it is still redirecting to localhost only. How can i change this behavior?

https://abc.myshopify.com/admin/oauth/authorize?client_id=&scope=&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fauth%2Fshopify%2Fcallback&state=HwGx2abEDOFhqDV&grant_options%5B%5D=

I have written my code in ruby and used shopify api and shopify app gem

Hello @abhimanyubv ,

Greetings from the Store Watchers Support Team! Happy to help you today.

To change this behavior you have to change the URL in the code as well.

For example, while getting the auth token or creating the charges you have to pass the redirect URL to Shopify API. Have you changed it? If not please change it is essential.

Happy to assist :slightly_smiling_face:

I am using shopify_app gem developed in Ruby. Below is the configuration. I had set the ENV[‘HOST’] to the actual domain and restarted the server. Even after this, the redirect_uri is still fixed to locahost

Rails.application.config.after_initialize do
if ShopifyApp.configuration.api_key.present? && ShopifyApp.configuration.secret.present?
ShopifyAPI::Context.setup(
api_key: ShopifyApp.configuration.api_key,
api_secret_key: ShopifyApp.configuration.secret,
api_version: ShopifyApp.configuration.api_version,
host_name: ENV[‘HOST’],
scope: ShopifyApp.configuration.scope,
is_private: !ENV.fetch(‘SHOPIFY_APP_PRIVATE_SHOP’, ‘’).empty?,
is_embedded: ShopifyApp.configuration.embedded_app,
session_storage: ShopifyApp::SessionRepository,
logger: Rails.logger,
private_shop: ENV.fetch(‘SHOPIFY_APP_PRIVATE_SHOP’, nil),
user_agent_prefix: “ShopifyApp/#{ShopifyApp::VERSION}”
)

ShopifyApp::WebhooksManager.add_registrations
end
end