Skip to content

Commit

Permalink
[React] Set changeOrigin: true for proxied Sitecore requests in con…
Browse files Browse the repository at this point in the history
…nected mode (#808)

* Set changeOrigin: true for proxied Sitecore requests in React connected mode - resolves 504 (Gateway Timeout) errors

* Add changelog
  • Loading branch information
ambrauer committed Sep 9, 2021
1 parent 2463ee8 commit aa52ead
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ This project does NOT adhere to [Semantic Versioning](https://semver.org/spec/v2

`[samples/angular]` Fix issue where dk-DA language is not rendered in connected and disconnected mode ([#734](https://github.com/Sitecore/jss/pull/734))

`[samples/react]` Fix 504 (Gateway Timeout) errors for proxied Sitecore requests (visitor identification, media, etc) when running in connected mode ([#808](https://github.com/Sitecore/jss/pull/808))

### Breaking Changes

`[sitecore-jss]` `[sitecore-jss-vue]` `[sitecore-jss-react-native]` `[sitecore-jss-react]` `[sitecore-jss-nextjs]` `[sitecore-jss-angular]` Remove deprecated `dataApi` ([#744](https://github.com/Sitecore/jss/pull/744))
Expand Down
6 changes: 3 additions & 3 deletions samples/react/src/setupProxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ module.exports = (app) => {
// when in connected mode we want to proxy Sitecore paths
// off to Sitecore

app.use(proxy('/sitecore', { target: config.sitecoreApiHost }));
app.use(proxy('/sitecore', { target: config.sitecoreApiHost, changeOrigin: true }));
// media items
app.use(proxy('/-', { target: config.sitecoreApiHost }));
app.use(proxy('/-', { target: config.sitecoreApiHost, changeOrigin: true }));
// visitor identification
app.use(proxy('/layouts', { target: config.sitecoreApiHost }));
app.use(proxy('/layouts', { target: config.sitecoreApiHost, changeOrigin: true }));
}
};

0 comments on commit aa52ead

Please sign in to comment.