How to Enable and Load mod_proxy_http in XAMPP: Complete Configuration Guide


7 views

When working with XAMPP on Windows/Linux, enabling proxy modules requires manual configuration since they're not activated by default. The mod_proxy_http.so exists in your XAMPP/apache/modules/ directory, but proper directives must be added to httpd.conf.

Navigate to your XAMPP installation directory and open apache/conf/httpd.conf in a text editor. Add these lines at the appropriate sections:

# Load the proxy modules
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

# Configure proxy settings (example)
<IfModule mod_proxy.c>
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyVia On
    <Proxy *>
        Require all granted
    </Proxy>
</IfModule>

After saving httpd.conf, restart Apache through XAMPP control panel. Verify activation using either method:

# Command line verification
httpd -M | grep proxy

# PHP verification
<?php 
phpinfo(INFO_MODULES);
?>

Here are practical examples of mod_proxy_http usage:

# Basic reverse proxy configuration
ProxyPass "/app" "http://backend-server:8080/"
ProxyPassReverse "/app" "http://backend-server:8080/"

# Load balancing setup
<Proxy balancer://mycluster>
    BalancerMember http://server1:8080
    BalancerMember http://server2:8080
</Proxy>
ProxyPass "/app" "balancer://mycluster"
ProxyPassReverse "/app" "balancer://mycluster"

If the module still doesn't load:

  • Check Apache error logs (apache/logs/error.log)
  • Verify module file permissions
  • Ensure no syntax errors in httpd.conf
  • Confirm XAMPP version compatibility

First, verify that the module file exists in your XAMPP directory. Navigate to:

XAMPP/apache/modules/mod_proxy_http.so

If the file is missing, you may need to reinstall XAMPP or download the module separately.

Open your Apache configuration file located at:

XAMPP/apache/conf/httpd.conf

Unlike some other modules, mod_proxy_http might not have a commented-out line in the default configuration. You'll need to add the following lines manually:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

Note that mod_proxy_http depends on mod_proxy. You must load both modules, and mod_proxy should be loaded first. The correct order is crucial:

  1. proxy_module
  2. proxy_http_module

After making changes, restart your Apache server through XAMPP control panel. Then check if the module loaded successfully:

httpd -M | grep proxy

Or create a PHP file with:

<?php phpinfo(); ?>

Search for "proxy" in the output.

If the module still doesn't load:

  • Check Apache error logs for specific messages
  • Verify file permissions on the module files
  • Ensure you're editing the correct httpd.conf file (XAMPP might have multiple)
  • Try clearing your browser cache when checking phpinfo()

Once loaded, you can use mod_proxy_http for reverse proxying:

<VirtualHost *:80>
    ServerName myproxy.example.com
    ProxyPass / http://backend-server:8080/
    ProxyPassReverse / http://backend-server:8080/
</VirtualHost>

When using mod_proxy_http, consider these settings for better performance:

ProxyRequests Off
ProxyPreserveHost On
ProxyTimeout 300