-
Notifications
You must be signed in to change notification settings - Fork 276
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
Node Proxy: query string values aren't transferred properly #140
Comments
There is workaround for packages -> sitecore-jss-proxy -> src -> index.ts Just replace line in the rewriteRequestPath method:
to:
Be careful as it may corrupt the method with same name in app |
@aweber1 Any updates on this or anyone know how this changes in 9.1? Still seeing query strings breaking routing in the node-jss-proxy. |
Two new workarounds, neither require forking or patching. Option 1:Assuming you've used the JSS sample as a basis, in
Option 2:Modify
The underlying issue stems from this line in the JSS proxy: jss/packages/sitecore-jss-proxy/src/index.ts Line 321 in 46e8ce2
Essentially, when the JSS proxy is rewriting a URL, for instance That function attempts to invoke the app router to "match" the URL to a route pattern used in the app, and then return any route parameters back to the proxy. For instance, the url above
That So both of the workaround options above address the issue, but in different ways. In option 1, we basically parse the URL provided by the JSS proxy, then use only the URL In option 2, we let everything happen as usual, but before the proxy request is made, we inspect the request and if it's a Layout Service request and the item parameter for the request has a querystring value, we just strip out that querystring value. |
Not sure if it's related, but I have a custom route in Sitecore which isn't working on the JSS proxy. This is the route:
When I visit /invoice/pay/56e46c3c-19d5-458c-a1a5-58f7ba190e47 on CM or CD it works and I get correct page and I have the id in the route data. When I visit it on the JSS proxy I get a 404 message. Is MapRoute supported? |
It now also works after adding to the pathRewriteExcludeRoutes in the config.js file:
|
@Eugenio161288 Fixed in commit |
Would this fix also fix the following problem: #171 ? |
@jbreuer No, it wasn't fixed. Currently, I'm working on it |
Description
The node proxy with sitecore-jss-proxy package does not transfer querystring values properly. As result it returns 404 error to client when query string value wasn't passed properly.
Expected behavior
The node proxy should pass query string values and shouldn't return 404 error if it isn't page
Steps To Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: