0

Edit: See my answer. I found the solution, but I'll leave this up as reference.

I'm on CentOS 7 with Apache 2.4.6

I'm trying to have a subdomain of mine redirect to a node.js express web server. The node server is listening on port 8080 and I can use wget http://localhost:8080 to download the page I want to load, so to me that means the problem I'm having is with the Apache proxy.

I tried following this which led to this, and then also tried the suggestions here, but I'm still getting a 503 "Service unavailable" page when I visit the URL.

This is my virtual host for that subdomain (actual url changed):

<VirtualHost *:80>
  ServerName foo.example.com

  ProxyPreserveHost On
  ProxyRequests Off

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass / http://localhost:8080/
  ProxyPassReverse / http://localhost:8080/

</VirtualHost>

I worried mod_proxy and mod_proxy_http weren't enabled even though httpd -M showed proxy_module (shared) and proxy_http_module (shared) in the list, so I've added the following lines to httpd.conf:

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

If there is anything obvious I'm doing wrong, or if there's any more information that would be helpful, please let me know! Thanks!

Duck
  • 21
  • 6

1 Answers1

2

Reading into the comments on one of the linked threads got my answer. I used the comment this caused an error "Service Unavailable" on my httpd until I did /usr/sbin/setsebool -P httpd_can_network_connect 1 from vladkras.

Duck
  • 21
  • 6
  • @PaulSerre Sure, it's the first link in my original post, which is [here](https://stackoverflow.com/questions/8541182/apache-redirect-to-another-port) – Duck Sep 14 '21 at 03:29