obsidian/wiki/concepts/apache-proxypass-include-files-ignored.md
2026-04-30 21:23:56 +01:00

4.1 KiB

title aliases tags sources created updated
Apache ProxyPass Silently Ignored in Include Files
apache-proxypass-include
apache-include-proxypass-ignored
apache
proxy
gotcha
optical-dev
deployment
daily/2026-04-29.md
daily/2026-04-30.md
2026-04-29 2026-04-30

Apache ProxyPass Silently Ignored in Include Files

On optical-dev.oliver.solutions, ProxyPass / ProxyPassReverse directives inside <Location> blocks placed in Apache include files (/etc/apache2/sites-available/includes/) are silently ignored — no error, proxy just doesn't work. Discovered after a long debugging session migrating video-accessibility from ai-sandbox to optical-dev.

Key Points

  • ProxyPass inside <Location> in an Included fragment file does NOT take effect on this server
  • The failure is completely silent — Apache loads the config without error, but requests are not proxied
  • Confirmed on two projects (video-accessibility and barclays) — same outcome
  • Fix: add ProxyPass directives directly to the main vhost file
  • Standard inline <Location> blocks in Include fragments (for aliases, rewrites) still work fine — only ProxyPass is affected

Details

The Pattern That Fails

# /etc/apache2/sites-available/includes/video-accessibility.conf
# (loaded via Include in the main vhost)
<Location /video-accessibility/api/>
    ProxyPass http://127.0.0.1:8042/api/
    ProxyPassReverse http://127.0.0.1:8042/api/
</Location>

Despite the file being included and Apache reloading cleanly (configtest OK), requests to /video-accessibility/api/ are not forwarded to the backend.

The Fix

Add ProxyPass blocks directly to the main vhost file:

# /etc/apache2/sites-available/optical-dev.oliver.solutions.conf
<VirtualHost *:443>
    ...
    # Inline — ProxyPass works here
    ProxyPass        /video-accessibility/api/ http://127.0.0.1:8042/api/
    ProxyPassReverse /video-accessibility/api/ http://127.0.0.1:8042/api/

    Include /opt/video-accessibility/deploy/apache-video-accessibility.conf
</VirtualHost>

The Include fragment can still handle Alias, <Directory>, RewriteRule — only ProxyPass must live in the main file.

Diagnosis Approach

If a new project proxy suddenly stops working after migration to optical-dev:

  1. Check if ProxyPass is inside an Include fragment
  2. Move it to the main vhost file
  3. sudo apache2ctl configtest && sudo systemctl reload apache2

Missing Include File Silently Stops Config Processing

A related but distinct failure mode: if an Include directive references a file that does not exist, Apache does NOT raise an error at configtest — it just silently aborts processing all directives below that line at runtime.

Behaviour

Include /opt/video-accessibility/deploy/apache-video-accessibility.conf
# ↑ If this file doesn't exist on disk:
#   - apachectl configtest → "Syntax OK" (no error)
#   - All directives below this line are NOT active at runtime
#   - ProxyPass rules added after this Include are silently ignored

Why configtest Passes

apachectl configtest validates Apache config syntax — it does not verify that included file paths actually exist. The missing file becomes a runtime issue, not a syntax issue.

Diagnosis

If ProxyPass rules added to the main vhost file are not working:

  1. Check the order of Include statements above your new rules
  2. Verify each included file actually exists: ls /opt/<project>/deploy/<file>.conf
  3. If a file is missing, either create it (can be empty) or remove the broken Include
  4. sudo apache2ctl configtest && sudo systemctl reload apache2

This is different from the primary issue above (ProxyPass inside Include being ignored even when the file exists) — here the Include file itself is absent.