Linux, Web Server & Database
Configure Apache Reverse Proxy
Set up Apache as a reverse proxy in front of your application, API or backend service.
The Problem
You've got an application running on an internal port but need it reachable through Apache on standard web ports with a proper domain, SSL, and without exposing the raw application port directly.
About this problem
Apache can act as a reverse proxy using mod_proxy, which is especially useful when you're already running Apache for other sites on the same server and want to add a proxied application without introducing a second web server just for that purpose.
This comes up when deploying a backend application alongside existing Apache-hosted sites, or when infrastructure already standardised on Apache rather than Nginx.
What's Included
- Enabling the required proxy modules (mod_proxy, mod_proxy_http, and websocket support if needed)
- Configuring ProxyPass and ProxyPassReverse directives correctly for your application
- Setting headers so your backend sees accurate client information
- Testing the full path from public domain through to the backend application
What's NOT Included
- Setting up or debugging the backend application itself
- SSL certificate setup (see the Let's Encrypt service, commonly paired with this)
- Load balancing across multiple backend instances (can be scoped as an extension of this service)
How It Works
- Enable mod_proxy and mod_proxy_http (and mod_proxy_wstunnel if WebSockets are needed).
- Add ProxyPass and ProxyPassReverse directives in the virtual host pointing at the internal application address.
- Set RequestHeader directives to forward accurate client IP and protocol information to the backend.
- Adjust timeout settings for the proxy to match the backend's actual response behaviour.
- Test the full request path, confirming the backend receives correct headers and responds as expected through Apache.
In practice: you buy the service, send over whatever access or details the job needs, I investigate and do the work, and you confirm it's resolved before we call it done.
Frequently Asked Questions
- Does Apache support reverse proxying like Nginx?
- Yes, via mod_proxy and related modules — it's a well-established, mature way to forward requests to a backend application from an Apache front end.
- Why isn't my ProxyPass configuration working?
- Common causes are the required modules not being enabled, a trailing slash mismatch between ProxyPass and ProxyPassReverse, or the backend address being unreachable from the server itself.
- Can Apache reverse-proxy to a Node.js application?
- Yes, Apache doesn't care what technology the backend uses, as long as it's reachable over HTTP on the internal address and port specified.
- Do I need both ProxyPass and ProxyPassReverse?
- Yes — ProxyPass forwards the request, while ProxyPassReverse rewrites any redirect responses from the backend so they reference the public-facing URL rather than the internal one.
- Why does my backend application see the wrong IP address?
- Without forwarding the real client IP via a header like X-Forwarded-For, the backend only sees Apache's own internal connection as the source.
- Is Apache or Nginx better for reverse proxying?
- Both handle it well — the right choice often comes down to what's already running on your server and your familiarity with each tool's configuration style.