Skip to content

amoshydra/example-apache-conf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apache Configuration Test Fixtures

Test Results (Auto-generated from local run)

Fixture Status Description
01 Cache Control ✅ 9/9 React & Angular cache headers
02 Security Headers ✅ 7/7 CSP, HSTS, X-Frame-Options
03 Cache Conflict ✅ 5/5 Documents directive conflicts

Summary: 21 passed, 0 failed, 0 skipped

Last updated: 2026-04-13 18:45:57 UTC (local)

Test Results (Auto-generated)

Fixture Status Description
01 Cache Control ✅ 9/9 React & Angular cache headers
02 Security Headers ✅ 7/7 CSP, HSTS, X-Frame-Options
03 Cache Conflict ✅ 5/5 Documents directive conflicts

Summary: 21 passed, 0 failed, 0 skipped

Last updated: 2026-04-13 18:41:05 UTC

This repository contains Apache HTTP Server configuration examples and a BATS-based testing framework for validating different scenarios.

Test Results (Auto-generated)

Fixture Status Description
01 Cache Control ❌ 0/9 React & Angular cache headers
02 Security Headers ❌ 4/7 CSP, HSTS, X-Frame-Options
03 Cache Conflict ❌ 0/5 Documents directive conflicts

Summary: 4 passed, 17 failed, 0 skipped

Last updated: 2026-04-13 18:06:36 UTC

Fixtures

01-cache-control

Proper cache header configuration for modern JavaScript frameworks:

React (Webpack)

  • index.html - no-cache, no-store, must-revalidate
  • Hashed JS/CSS files (e.g., main.a3f2b1c.js) - max-age=31536000, immutable

Angular (CLI)

  • index.html - no-cache, no-store, must-revalidate
  • Bundles with hash (main, runtime, polyfills) - max-age=31536000, immutable
  • Assets folder - max-age=86400 (1 day)

02-security-headers

Comprehensive security header configuration:

  • Content-Security-Policy (CSP)
  • X-Frame-Options: SAMEORIGIN
  • X-Content-Type-Options: nosniff
  • X-XSS-Protection: 1; mode=block
  • Referrer-Policy: strict-origin-when-cross-origin
  • Permissions-Policy: feature restrictions
  • Strict-Transport-Security (HSTS)

03-cache-conflict

Intentionally misconfigured - demonstrates how directive ordering and always can corrupt location-specific headers. The global Header always set Cache-Control overrides all carefully configured cache headers.

Project Structure

.
├── fixtures/
│   ├── 01-cache-control/       # Cache control for React & Angular
│   ├── 02-security-headers/    # Security headers
│   └── 03-cache-conflict/      # Intentionally wrong config (demo)
├── test/
│   ├── helper.bash             # Shared test utilities
│   ├── 01-cache-control.bats   # Tests for fixture 01
│   ├── 02-security-headers.bats
│   └── 03-cache-conflict.bats
├── .githooks/
│   └── pre-push                # Validates fixtures before push
└── .github/workflows/
    └── test.yml                # GitHub Actions CI

Setup

Install Git Hooks

./scripts/install-hooks.sh

This installs a pre-push hook that validates fixture structure before each push.

Run Tests Locally

Requires: BATS and Podman

# Run all tests
cd test
bats *.bats

# Run specific fixture
bats 01-cache-control.bats

# With TAP output
bats --tap 01-cache-control.bats

Run with GitHub Actions

Tests run automatically on push. See .github/workflows/test.yml.

License

MIT

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Contributors