I have 3 different applications deployed on the same server. Each on different ports
- One java API application running on port 8080. directory (/home/api/)
- Second nextjs web app running on port 3000. directory (/home/web)
- Third vuejs admin panel application on default port 80 deployed inside subdirectory (/var/www/html/admin)
This is an apache config file test.conf
ServerName www.test.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# Setup reverse proxy for all server
ProxyPreserveHost On
ProxyPass /admin http://localhost/admin
ProxyPassReverse /admin http://localhost/admin
ProxyPass /api http://localhost:8080/api
ProxyPassReverse /api http://localhost/api
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost/
API is working fine at http://test.com/api URL.
The website is also working fine at http://test.com URL.
The problem occurs when I access http://test.com/admin URL.
It shows the following error in browser:-
Your browser sent a request that this server could not understand. The size of a request header field exceeds the server limit.
with status code 400 Bad request and If I remove the admin panel from reverse proxy and create another vhost file with a simple configuration like below:-
This is another apache vhost config file test-admin.conf
ServerName www.test.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory /var/www/html/admin>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
Order allow,deny
Allow from all
</Directory>
then other URL stops working showing 404 Not Found error.
Note:- www.test.com is just to represent the actual domain name or IP.