简体   繁体   English

生产中子目录中的Rails应用无法正确重定向以安装shopify商店

[英]Rails app in subdirectory in production not redirecting properly to install shopify store

Using localhost:3000 I was able to install the shopify store and interact with it. 使用localhost:3000,我能够安装shopify商店并与其进行交互。 However, when deploying it into production, which is in a subdirectory (www.website.com/app_name), the "login" for the shop is redirected to root and not to the subdirectory. 但是,将其部署到子目录(www.website.com/app_name)中的生产环境中时,商店的“登录”将重定向到root而不是子目录。 I whitelisted the redirect urls in the shopify app dashboard. 我在shopify应用仪表板中将重定向URL列入了白名单。

In omniauth.rb 在omniauth.rb中

callback_url: "http://{domain}/{app_name}/auth/shopify/callback"

In routes.rb 在routes.rb中

mount ShopifyApp::Engine, at: '/{app_name}'

Apart from the code above, the settings for shopify are the ones that the generator created. 除了上面的代码,shopify的设置是生成器创建的设置。 Any ideas in how to fix this? 有关如何解决此问题的任何想法?

Tanks! 坦克!

When I did that pattern I had to set the prefix for OmniAuth... in my old config.ru that works for this.. see.. 当我执行该模式时,我必须在适用于此的旧config.ru中设置OmniAuth ...的前缀。

use OmniAuth::Builder do
  # allow us to connect this App via the /fooblefuzz route instead of just 
  the root of the heroku app URL /
  configure do |config|
      config.path_prefix = '/fooblefuzz/auth'
  end

So this code works as https://www.example.com/fooblefuzz/auth/shopify/callback 因此,此代码可用作https://www.example.com/fooblefuzz/auth/shopify/callback

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM