You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Using a proxy like nginx or skipper to do rewrites of URL's for the tag pages do not stick. They are overridden and revert back to the system defined route when query params change.
To Reproduce
Steps to reproduce the behavior:
Setup the full Reaction Platform
Add rewrite rewrite rule for from: /tags/example/product to: /tags/example-product
Navigate to http://localhost:<proxy-port>/tags/example/product
See that you do get the correct page
After a second or two, see that the URL has changed to http://localhost:<proxy-port>/tags/example-product?limit=20
Expected behavior
URL should remain in the same style as the rewrite.
This issue can be resolved, but the commitment to disabling single page app (SPA) links must be fully realized.
At the moment, if you disable SPA links, the first request to a new tag or PDP page will force a window.location. Filtering lists or selecting variants on those pages would still trigger via pushState.
To be able to use rewrite rules to have arbitrary links to pages like these, then they cannot be allowed to modify the route via pushState.
They must also "know" the URL the proxy expects, e.g. /example/product instead of that the next.js app expects, which is /tag/example-product.
Otherwise, next.js or the underlying express server must be made aware of routes like /example/product so it can render the correct page or state.
What I did to get to this conclusion
set ENABLE_SPA_LINKS=false in .env
Modify router.js to indeed force every link to perform a window.location
Disable updates to the URL on componentDidMount of the tag page. This is bad and causes an infinite loop.
Disable updates to the UIStore for filtering so pages don't change, then change again when the browser reloads.
Set up a rewrite in Reaction /example/product => /tag/shirts
Navigate to a tag page
Hard code /example/product into Router.setSearch, so simulate "knowing" the rewrite URL.
Use page limit control
Success!! URL is now /example/product?limit=60
Anything short of that caused the URL to revert from /example/product to /tag/example-product?limit=60
Type: minor
Describe the bug
Using a proxy like nginx or skipper to do rewrites of URL's for the tag pages do not stick. They are overridden and revert back to the system defined route when query params change.
To Reproduce
Steps to reproduce the behavior:
/tags/example/product
to:/tags/example-product
http://localhost:<proxy-port>/tags/example/product
http://localhost:<proxy-port>/tags/example-product?limit=20
Expected behavior
URL should remain in the same style as the rewrite.
http://localhost:<proxy-port>/example/product?limit=20
The text was updated successfully, but these errors were encountered: