0

I'm currently trying to forward this url https://example.com/screenshot to http://localhost:8443 the reason why I'm trying to do this is because I have an express js server running that I need to be accessed via https. All the documentation I read pointed me to proxy pass. In my etc/httpd/conf I've added this code:

# mod_proxy setup.
ProxyRequests Off
ProxyPass /screenshot https://localhost:8443
ProxyPassReverse /screenshot https://localhost:8443
<Location "/screenshot">
  Order allow,deny
  Allow from all
</Location>

I restarted my server after this.
I also ensured that this was in my file.

LoadModule proxy_http_module modules/mod_proxy_http.so

When I go to https://example.com/screenshot after all this I get a 404 error. Is there anyway I could test to see if it's even working.

EDIT: I'm tried adding the trailing / /screenshot/ https://localhost:8443/ and still get 404.

FabricioG
  • 167
  • 1
  • 7
  • Are you sure you don't need the trailing slashes, like: `ProxyPassReverse /screenshot/ https://localhost:8443/` ? What's in the logs? – Lenniey Nov 13 '18 at 08:13
  • I'll add the trailing slashes and try that. Log says this: 76.175.204.11 - - [13/Nov/2018:12:14:55 -0700] "GET /screenshot/ HTTP/1.1" 404 1699 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36" @Lenniey – FabricioG Nov 13 '18 at 19:21

1 Answers1

0

Ok so after hours and hours of research I discovered that I'm not all that smart. I had the wrong file! However I learned a few things that would probably be helpful for someone else. First is that since each server is configured differently the httpd.conf is in different locations. Hardly any tutorials explained this. The golden command was this:

apachectl -S

Depending on your server the command might be different on some it's apache2ctl -S This golden command tells you which virtual hosts are loading:

myip:80     is a NameVirtualHost
         default server smyip.secureserver.net (/etc/apache2/conf/httpd.conf:230)

There you can find the file where the httpd.conf is being loaded.

For a noob like me this took quite some time, so hopefully it'll help someone else.

FabricioG
  • 167
  • 1
  • 7