Skip to content
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

[Next.js] Use more focused paths for Sitecore rewrites #921

Merged
merged 1 commit into from
Feb 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ const disconnectedPlugin = (nextConfig = {}) => {

return Object.assign({}, nextConfig, {
async rewrites() {
// When disconnected we proxy to the local faux layout service host, see scripts/disconnected-mode-server.js
// When disconnected we proxy to the local faux layout service host, see scripts/disconnected-mode-proxy.ts
return [
// API endpoints
{
source: '/sitecore/:path*',
destination: `${disconnectedServerUrl}/sitecore/:path*`,
source: '/sitecore/api/:path*',
destination: `${disconnectedServerUrl}/sitecore/api/:path*`,
},
// media items
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ const nextConfig = {
async rewrites() {
// When in connected mode we want to proxy Sitecore paths off to Sitecore
return [
// API endpoints
{
source: '/sitecore/:path*',
destination: `${jssConfig.sitecoreApiHost}/sitecore/:path*`,
source: '/sitecore/api/:path*',
destination: `${jssConfig.sitecoreApiHost}/sitecore/api/:path*`,
},
// media items
{
Expand All @@ -58,8 +59,8 @@ const nextConfig = {
},
// visitor identification
{
source: '/layouts/:path*',
destination: `${jssConfig.sitecoreApiHost}/layouts/:path*`,
source: '/layouts/system/:path*',
destination: `${jssConfig.sitecoreApiHost}/layouts/system/:path*`,
},
];
},
Expand Down