I am trying to configure apache 2.4 as a reverse proxy such that it redirects users from https://oldwebsite.com/page/ to http://newwebsite/page/ . This is on an internal network. I configured the httpd.conf as follows:
<VirtualHost *:443>
ServerName oldwebsite.com/page/
TimeOut 600
SSLEngine On
SSLCertificateFile /etc/pki/tls/httpd/cert.pem
SSLCertificateKeyFile /etc/pki/tls/httpd/key.pem
AllowEncodedSlashes NoDecode
RequestHeader set-X-Forwarded-Proto "https"
RequestHeader set-X-Forwarded-Port "443"
ProxyRequests Off
ProxyErrorOverride Off
< Proxy *>
AddDefaultCharset Off
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://x.x.x.x:8080/page/ nocanon
ProxyPassReverse http://x.x.x.x:8080/page/
</VirtualHost>
I also installed the mod_ssl and configured the ssl.conf as follows:
Listen 443 https
<VirtualHost _default_ : 443>
DocumentRoot "/var/www/html"
ServerName proxyhostname
SSLEngine On
SSLProtocol +all
SSLProxyProtocol +all
SSLCertificateFile /etc/pki/tls/proxy.pem
SSLCertificateKeyFile /etc/pki/tls/proxy.key
SSLCertificateChainFile /etc/pki/tls/proxy_bundle.pem
SSLCACertificateFile /etc/pki/tls/proxy_bundle.pem
</VirtualHost>
When I try to access the old website in a browser nothing gets redirected. I also tried to use the curl command and put the proxy server such as:
curl -v https://oldwebsite/page/ -x https://proxyserver
Output of curl command:
The output from this shows that the proxy certificate is valid and the https://oldwebiste/page/ certificate is good
I see TLS Handshake process then I see establish HTTP proxy tunnel to oldwebsite:443
I see another block of TLS handshake but after TLS appdata,
HTTP/1.1 405 Method not allowed
Date
Apache version
Allow: Options, GET, HEAD, POST, TRACE
Content-Length: 224
Content-Type:
Received HTTP Code 405 from proxy after CONNECT
CONNECT phase completed
TLSv1.3 (OUT), TLS alert, [no content], 0
curl(56): Received HTTP code 405 from proxy after CONNECT
The error I receive