Using Virtual_host and mod_proxy together with Multi Port

Alles, was den Apache betrifft, kann hier besprochen werden.

Using Virtual_host and mod_proxy together with Multi Port

Postby Nassco » 25. May 2021 10:08

Dear Apache Friends,

Currently I need to perform these request on Apache server that used as a proxyreverse. My scenario as follow:

I have AWS connect to Middle server that run Jboss then this server connect to Linux Ubuntu which work as WAF!
I have three URLS that need to be resolved on three ports 8080, 8085, 8083 per below:

http://192.168.12.110:8080/eventplusmanagement
http://api-eventStatus.mycompany.net/eventplusmanagement


http://192.168.12.110:8085/eventnotificationmanagement
http://api-eventStatus.mycompany.net/eventnotificationmanagement


http://192.168.12.110:8083/eventincidentmanagement/
http://api-eventStatus.mycompany.net/eventincidentmanagement

The above will work fine using the IPs but not the friendly name.

My Config looks like this:

<VirtualHost *:443>
ServerName api-eventStatus.mycompany.net
ServerAdmin itsupport@mycompany.net
#DocumentRoot /var/www/api-eventStatus.mycompany.net

ErrorLog ${APACHE_LOG_DIR}/api-eventStatus.mycompany.net/error.log
CustomLog ${APACHE_LOG_DIR}/api-eventStatus.mycompany.net/access.log combined

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/mycompany.net.crt
SSLCertificateKeyFile /etc/apache2/ssl/private/mycompany.net.key
SSLCertificateChainFile /etc/apache2/ssl/jd_bundle-h8-s9.crt

# <LocationMatch "/main">
# SecRuleRemoveById 200004
# </LocationMatch>

#Don't pass errors folder to backend serve from this server
#Without ProxyErrorOverride On the page will just reload in the case of a 403 error, setting to another path will cause a 404 not found within JBOSS
ProxyPass /errorpages/ !
ProxyErrorOverride On
ErrorDocument 400 /errorpages/invalid.html
ErrorDocument 401 /errorpages/invalid.html
ErrorDocument 403 /errorpages/invalid.html
ErrorDocument 404 /errorpages/404.html
ErrorDocument 500 /errorpages/serviceunavailable.html
ErrorDocument 502 /errorpages/serviceunavailable.html
ErrorDocument 503 /errorpages/serviceunavailable.html
ErrorDocument 504 /errorpages/serviceunavailable.html
#Don't proxy favicon, serve locally so error messages outside app server website have correct ico as well
ProxyPass /favicon.ico !
#everything under the root / will be mapped at the given address
ProxyPass /eventincidentmanagement/ http://192.168.12.110:8083/
#modify the response headers from backend server
ProxyPassReverse /eventincidentmanagement/ http://192.168.12.110:8083/
#everything under the root / will be mapped at the given address
ProxyPass /eventnotificationmanagement/ http://192.168.12.110:8085/
#modify the response headers from backend server
ProxyPassReverse /eventnotificationmanagement/ http://192.168.12.110:8085/
#everything under the root / will be mapped at the given address
ProxyPass /eventplusmanagement/ http://192.168.12.110:8080
#modify the response headers from backend server
ProxyPassReverse /eventplusmanagement/ http://192.168.12.110:8080/
</VirtualHost>

Any idea why the friendly URL not working but IP works fine? DNS but where?

System Specs:
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"

Thanks,
Nassco
 
Posts: 2
Joined: 25. May 2021 09:31
XAMPP version: 2.3
Operating System: Linux Ubuntu

Re: Using Virtual_host and mod_proxy together with Multi Por

Postby Nobbie » 25. May 2021 17:26

Its extremely difficult to understand, what you try to do, but first of all you are building a reverse proxy to https: in your configuration, NOT to http:

For example

Code: Select all
ProxyPass /eventincidentmanagement/ http://192.168.12.110:8083/
#modify the response headers from backend server
ProxyPassReverse /eventincidentmanagement/ http://192.168.12.110:8083/


redirects your Server from

https://api-eventStatus.mycompany.net/eventincidentmanagement/ to http://192.168.12.110:8083/

There is no rule and no VirtualHost for http://api-eventStatus.mycompany.net/eventincidentmanagement/, as your one and only VirtualHost runs on Port 443 with SSL. For http: you need a VirtualHost on *:80.
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04

Re: Using Virtual_host and mod_proxy together with Multi Por

Postby Nassco » 26. May 2021 09:43

Thanks Nobbie,

I know my request is quiet unique in the requirement.

But as stated in my original post accessing/calling the request with htp://IP:port/folder will work fine but not the friendly name!


So you are saying for this API request I should do the changes under:
<VirtualHost *:80>
</VirtualHost >
If I place the above in the virtualhost *:80 will it work? I am not interested in https as this is an internal API application that will perform the request internally?


Thanks
Nassco
 
Posts: 2
Joined: 25. May 2021 09:31
XAMPP version: 2.3
Operating System: Linux Ubuntu

Re: Using Virtual_host and mod_proxy together with Multi Por

Postby Nobbie » 26. May 2021 10:17

I dont know, you simply have to try. You have to remove all SSL handling of course also.
Nobbie
 
Posts: 13182
Joined: 09. March 2008 13:04


Return to Apache

Who is online

Users browsing this forum: No registered users and 13 guests