Score:1

Apache 2.4.x Reverse Proxy subdirectory and ports issue?

in flag

I have 3 different applications deployed on the same server. Each on different ports

  1. One java API application running on port 8080. directory (/home/api/)
  2. Second nextjs web app running on port 3000. directory (/home/web)
  3. 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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.