Skip to content

Commit b58c991

Browse files
committed
🐛(nginx) fix 404 when accessing a doc
We improve the nginx way to access to a specific doc. We stop to wait for a initial attempt that give a 404. If we see a UUID in the url we will redirect to the doc/[id] page. Next will then manage the 404.
1 parent 96f6aee commit b58c991

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ and this project adheres to
2424

2525
⚡️(frontend) reduce unblocking time for config #867
2626

27+
## Fixed
28+
29+
- 🐛(nginx) fix 404 when accessing a doc #866
30+
2731
## [3.1.0] - 2025-04-07
2832

2933
## Added

src/frontend/apps/e2e/__tests__/app-impress/doc-routing.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import crypto from 'crypto';
2+
13
import { expect, test } from '@playwright/test';
24

35
import {
@@ -101,8 +103,9 @@ test.describe('Doc Routing: Not loggued', () => {
101103
page,
102104
browserName,
103105
}) => {
104-
await mockedDocument(page, { link_reach: 'public' });
105-
await page.goto('/docs/mocked-document-id/');
106+
const uuid = crypto.randomUUID();
107+
await mockedDocument(page, { link_reach: 'public', id: uuid });
108+
await page.goto(`/docs/${uuid}/`);
106109
await expect(page.locator('h2').getByText('Mocked document')).toBeVisible();
107110
await page.getByRole('button', { name: 'Login' }).click();
108111
await keyCloakSignIn(page, browserName, false);

src/frontend/apps/e2e/__tests__/app-impress/language.spec.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,11 @@ test.describe.serial('Language', () => {
5454
}) => {
5555
// Helper function to intercept and assert 404 response
5656
const check404Response = async (expectedDetail: string) => {
57-
const expectedBackendResponse = page.waitForResponse(
58-
(response) =>
59-
response.url().includes('/api') &&
60-
response.url().includes('non-existent-doc-uuid') &&
61-
response.status() === 404,
57+
const interceptedBackendResponse = await page.request.get(
58+
'http://localhost:8071/api/v1.0/documents/non-existent-doc-uuid/',
6259
);
6360

64-
// Trigger the specific 404 XHR response by navigating to a non-existent document
65-
await page.goto('/docs/non-existent-doc-uuid');
66-
6761
// Assert that the intercepted error message is in the expected language
68-
const interceptedBackendResponse = await expectedBackendResponse;
6962
expect(await interceptedBackendResponse.json()).toStrictEqual({
7063
detail: expectedDetail,
7164
});

src/frontend/apps/impress/conf/default.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ server {
99
try_files $uri index.html $uri/ =404;
1010
}
1111

12-
location /docs/ {
13-
error_page 404 /docs/[id]/;
12+
location ~ "^/docs/[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/?$" {
13+
try_files $uri /docs/[id]/index.html;
1414
}
1515

1616
error_page 404 /404.html;

0 commit comments

Comments
 (0)