New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache with and without subdomain are causing inconsistent urls. #6160
Comments
Hmm I would argue you should only be serving your store over a canonical url... Solution should be easy enough though just add the request subdomain/domain to the cache key. |
I also got inconsistent url on my app especially on product page. I deployed a vanilla spree app 3.0 on heroku and got http://0.0.0.0/products/ruby-on-rails-ringer-t-shirt. I fixed this by going into "admin > clear cached" but the problem comes back the next day. You can test from the below app and click on the first product. In addition, you can use spree@example.com to sign into the admin to clear cached. |
this something we have been dealing with ourselves, to fix this: the problem is that the page is saved to cache after a user requests it, so if a user requests http://0.0.0.0/particular-path that path is found locally and therefore cached. |
boxtels, Where do you modify the nginx config? in the Profile? and what is script do you put it there so it use https://mydomain.com. |
@NathanNg
|
@priyank-gupta @damianlegawiec @Mafi88 - I am able to verify the issue, one solution for this seems to me is we should use _path route helpers instead of _url helpers (at least in views have caching). Please let me know your thoughts on this. |
@nishant-cyro @priyank-gupta @damianlegawiec Or, as @JDutil suggested, we could probably "add the request subdomain/domain to the cache key". No idea which one is a better approach. |
@Mafi88 @nishant-cyro I think adding subdomain/domain to the cache key may be a better approach. As user should not be restricted to work on respective preferred style of coding. Also, there may be cases when _url helpers are required. |
Steps to reproduce:
1- In the Spree store deployed soemwhere (let's say, example.com), set up 2 subdomains, e.g.: www and production.
2- Visit the page of a product that has 2 variants using production.example.com.
3- Visit one variant of the product using production.example.com, and the other variant using www.example.com
4- Navigate through variants.. notice how the url of a variant is www.example.com/* and the other is production.example.com/*, and it changes when visiting these variants.
5- Search for the same product from www.example.com and note how the subdomain of the variants do not remain consistent.
So, the issue is caused by cache: when the page is cached, then it's with one subdomain, and when visited from another then it looks inconsistent.
The text was updated successfully, but these errors were encountered: