I'm trying to setup a forward proxy to access certain endpoints on Remote server which require https with basic authentication in header.
A(Application server) ---> Forward proxy (B) ----> Remote server(C)
i'm at B on which i have setup below Apache Virtual host in which i'm setting the headers to use basic authentication passing encoded value of user & pass configured on remote server.However,i want to include HTTPS in my request to C to ensure the headers are sent securely with encrption to remote server (C). I do Not want to use a separate Virtual host for HTTPS. Should i include a SSL Server certificate in my proxy configuration as given below with the basic authentication in header ?
How can i achieve this in Single virtual host ? I have limited knowledge on apache, so please help here.
I tried searching on the internet but did not find the required solution.
##### vHost 9099 is for basic auth with HTTPS #####
Listen *:9099
<VirtualHost *:9099>
ServerName myservername.com
ServerAlias myservername.com
ServerAdmin iamadmin@myservername.com
DocumentRoot /my/doc/root/
SSLEngine on
RewriteEngine On
AllowEncodedSlashes NoDecode
ProxyRequests On
# SSL configuration
SSLCertificateFile /Path to cert.pem
SSLCertificateKeyFile /Path to private key
SSLCACertificateFile /Path to CA certs
## Basic64 Encoded XXXX od user and passwd in header
RequestHeader set Authorization "Basic XXXXX"
## Endpoints accessed via https with basic authentication in header
ProxyPass /api/api1/ https://30.30.115.22:11111/api/api1/
ProxyPassReverse /api/api1/ https://30.30.115.22:11111/api/api1/
</VirtualHost>