The error message you're seeing - "Invalid command 'ProxyPass'" - typically occurs when Apache's proxy modules aren't properly configured or loaded, despite what the debug output might suggest. The key detail here is that while proxy_http_module
appears in your debug output, you're missing its fundamental dependency: mod_proxy.so
.
Apache's proxy functionality works in a layered architecture:
mod_proxy.so (core proxy module)
├── proxy_http_module (HTTP protocol support)
├── proxy_ajp_module (AJP protocol support)
└── ... other protocol modules
Uncomment and activate the core proxy module in your httpd.conf:
# Old (incorrect):
#LoadModule proxy_module modules/mod_proxy.so
# New (correct):
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Here's a verified working SSL proxy configuration:
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile "conf/ssl/server.crt"
SSLCertificateKeyFile "conf/ssl/server.key"
# REQUIRED proxy modules
ProxyRequests Off
ProxyPreserveHost On
SSLProxyEngine On
# Proxy configuration
ProxyPass /app/ http://backend-server:8080/
ProxyPassReverse /app/ http://backend-server:8080/
# Security restrictions
<Proxy *>
Require all granted
</Proxy>
</VirtualHost>
After making changes:
- Run
httpd -t
to test configuration syntax - Check loaded modules with
httpd -M
- Look for both
proxy_module
andproxy_http_module
in output
- Module load order matters - core modules must load first
- Windows paths require double backslashes or forward slashes
- Firewall may block internal proxy connections
If issues persist, enable detailed logging:
LogLevel debug
ProxyVia On
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
Many developers encounter this puzzling situation where Apache clearly shows proxy_http_module
loading in debug output, yet stubbornly claims ProxyPass
is an invalid command. Here's what's really happening under the hood.
The critical detail often missed is that mod_proxy_http.so
depends on mod_proxy.so
being loaded first. Even though your debug output shows proxy_http_module
loading, the parent module isn't active. Here's the proper loading sequence:
# Essential proxy modules must load in this order:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
When working with SSL VirtualHosts, there are additional considerations. The ProxyPass directive in your httpd-ssl.conf
needs proper context. Here's a working example:
<VirtualHost _default_:443>
SSLEngine on
SSLCertificateFile "conf/ssl/server.crt"
SSLCertificateKeyFile "conf/ssl/server.key"
# Proxy configuration
<IfModule mod_proxy.c>
ProxyRequests Off
ProxyPreserveHost On
ProxyPass / http://backend-server:8080/
ProxyPassReverse / http://backend-server:8080/
</IfModule>
</VirtualHost>
For quick verification of loaded modules, use:
httpd -M | grep proxy
You should see both proxy_module
and proxy_http_module
in the output.
Watch out for these configuration mistakes:
- Module load order matters - parent modules must load before their dependencies
- Check for duplicate LoadModule directives
- Verify module files exist in the specified path
For complex proxy setups with SSL termination:
<VirtualHost *:443>
ServerName api.example.com
SSLEngine On
# SSL certificates configuration...
# Proxy configuration with custom timeout
ProxyTimeout 300
ProxyPass /api/ http://internal-api-cluster/
ProxyPassReverse /api/ http://internal-api-cluster/
# Headers management
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
</VirtualHost>