Generates the nginx rules for prerendered pages
Pages now map to their html file, other forms get one redirect, unknown URLs get a real 404 and responses are compressed. A browser-free test suite runs the rules against a real nginx, in CI only so far. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -59,7 +59,10 @@ describe('serverconfiguratie', () => {
|
||||
const nginx = nginxTestConf();
|
||||
expect(nginx).toContain('X-Robots-Tag "noindex, nofollow"');
|
||||
expect(nginx).toContain('Disallow: /');
|
||||
expect(nginx).toContain('try_files $uri $uri/ /index.html =404;');
|
||||
// Geen SPA-fallback (BR-HST-02) en geen mapdoorverwijzing (BR-HST-07)
|
||||
expect(nginx).toContain('try_files $uri $uri.html =404;');
|
||||
expect(nginx).not.toMatch(/try_files[^;]*\$uri[^;]*\/index\.html/);
|
||||
expect(nginx).not.toContain('$uri/');
|
||||
});
|
||||
|
||||
it('het testblok claimt nooit de standaardserver (WordPress op dezelfde Pi)', () => {
|
||||
@@ -87,8 +90,11 @@ describe('serverconfiguratie', () => {
|
||||
|
||||
it('elk nginx location-blok herhaalt de security headers', () => {
|
||||
// nginx erft add_header niet als een location er zelf een zet
|
||||
const blocks = nginxTestConf().split('location ').slice(1);
|
||||
expect(blocks).toHaveLength(3);
|
||||
const blocks = nginxTestConf()
|
||||
.split(/^ *location /m)
|
||||
.slice(1);
|
||||
// robots.txt, 404, 404.html, assets, de beginpagina en de rest
|
||||
expect(blocks).toHaveLength(6);
|
||||
for (const block of blocks) {
|
||||
expect(block).toContain('Content-Security-Policy');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user