elasticpath / react-pwa-reference-storefront

Reference Storefront Progressive Web Application in React
https://documentation.elasticpath.com/storefront-react/index.html
GNU General Public License v3.0
44 stars 21 forks source link

Explicitly set followlocation to true for AWS API Gateway #248

Closed dmacbride-ep closed 5 years ago

dmacbride-ep commented 5 years ago
  Issues submitted without sufficient information will be rejected.

Step 3: Describe the problem:

We have an AWS API Gateway in front of cortex. The API Gateway is not passing the 'followlocation' parameter to cortex on requests where no value is set for 'followlocation'. That is, when a request to the API gateway includes a query string like ?zoom=blah&followlocation, the API Gateway will strip off followlocation, and the query string that makes it to cortex is just ?zoom=blah.

Steps to reproduce:

  1. Deploy an AWS API Gateway. EP CloudOps v3.2 does this for you. You also need to apply some changes to the config so that a) it uses method 'http' instead of 'http_proxy' and b) it maps the 'Accept' and 'Content-Type' headers on the request.
  2. Build the reference store so that cortex calls are made to the AWS API Gateway (not to an nginx proxy)
  3. Browse to the store and click a category

Observed Results:

The category page never opens and the spinner spins for ever. In the 'network' tab of the developer tools you see that the response body is empty, for the cortex request like(/cortex/navigations/mobee/lookups/form?zoom=items,items:element,items:element:code,items:element:availability,items:element:definition,items:element:definition:assets:element,items:element:price,items:element:rate,element,element:availability,element:definition,element:definition:assets:element,element:price,element:rate,element:code&followlocation)

Expected Results:

The page will load because the cortex response body contains a valid json response.

Suggested Change:

To work around this AWS API Gateway behaviour, the store code could explicitly set followlocation=true in all cortex calls that include followlocation. Per Matt B on the EP PD team: "followlocation=true is the same as just followlocation".

shaunmaharaj commented 5 years ago

Following up to our discussion on the EP PD channel, usages of followlocation have been updated to followlocation=true to ensure query parameters are maintained in urls.