1

I'm running Apache 2.4 on AWS Linux as httpd. I've a single domain, and all requests are directed via /conf/httpd.conf using Listen: 80 and DocumentRoot "/var/www/html". My current domain does use SSL, with the certificates installed on the server.

I'm now at a point where I'd like to introduce a reverse proxy setup to point at another server if a directory match exists. So, for example:

  • http://example.com/ should show files from /var/www/html
  • http://example.com/myAPI/ should be redirected to http://12.34.56.78:9876/

I've been attempting to follow the documentation here, and some examples here, and here, but seem to wind up in various states of not being able to start the http daemon, or the daemon successfully starting but not performing any redirects because the /myAPI/ call is not being redirected.

I've been attempting various versions of this in /conf/httpd.conf followed by a service restart.

#About line 44 in an otherwise largely unmodified config file
#Listen 80

<VirtualHost *:80>

   ProxyPreserveHost on
   SSLProxyEngine on

   ServerName example.com

   ProxyPass        "/myAPI" "http://12.34.56.78:9876/"
   ProxyPassReverse "/myAPI" "http://12.34.56.78:9876/"

</VirtualHost>

Note: I am not running a default-site.conf file. I, quite frankly, am not sure if it will make a difference, and when I've tried to set it up I seem to cause a litany of other issues. So if my example is achievable from the default httpd.conf I'd prefer to work in there.

1
  • Your config looks fine. Does the Apache error log tell you anything useful? Try turning up the log level, say to LogLevel trace3. May 13, 2021 at 11:06

0

You must log in to answer this question.

Browse other questions tagged .