Skip to content

Commit

Permalink
Fix x-using header (#1615)
Browse files Browse the repository at this point in the history
* Use `/:path*` as it includes i18n links.

See: https://nextjs.org/docs/pages/api-reference/next-config-js/headers#headers-with-i18n-support

* Use `withFaust` in app router example

* Update package-lock.json

* Add changeset

* Fix test
  • Loading branch information
blakewilson authored Oct 17, 2023
1 parent a855b98 commit 3722ab3
Show file tree
Hide file tree
Showing 5 changed files with 271 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/slimy-plants-enjoy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@faustwp/core': patch
---

Fix `x-using` header not appearing when i18n options are set in `next.config.js`
6 changes: 4 additions & 2 deletions examples/next/app-router/next.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { withFaust } from '@faustwp/core';

/** @type {import('next').NextConfig} */
export default {
export default withFaust({
experimental: {
serverActions: true,
},
};
});
260 changes: 260 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/faustwp-core/src/config/withFaust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export async function addHeaders(
}

headers.push({
source: '/(.*?)',
source: '/:path*',
headers: [
{
key: 'x-using',
Expand Down
2 changes: 1 addition & 1 deletion packages/faustwp-core/tests/config/withFaust.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('withFaust', () => {
);
const headers = await finalConfig.headers!();
expect(headers).toEqual([
{ headers: [{ key: 'x-using', value: 'faust' }], source: '/(.*?)' },
{ headers: [{ key: 'x-using', value: 'faust' }], source: '/:path*' },
]);
});
test('it applies a default redirects config', async () => {
Expand Down

0 comments on commit 3722ab3

Please sign in to comment.