0

I have trouble configuring the reverse proxy for my setup.

I have a frontend built using Angular and a backend built using Spring (running Spring boot currently)

Now, i have already configured apache to receive request for frontend. Frontend can now display angular application correctly.

However, there is a REST-API calls to backend inside angular application always throw 404. Tried checking backend (spring), i have access logs. It means that maybe reverse proxy is working but when i try to check the network logs in browsers, request to API call always shows 404. See image below

Even though it shows 404, i can receive the request in backend and confirmed it through logs.

Need a another set of eyes to look at this. what am i missing? maybe i may have misunderstood other configuration directive here. Please do share your insights or fix for that matter. Appreciate it.

Here is my .conf file in apache

Listen 9999
<VirtualHost *:9999>

  ServerAdmin test@admin.com
  DocumentRoot "/var/www/html/test"
  ServerName test
  ErrorLog "/var/log/httpd/test-error.log"
  CustomLog "/var/log/httpd/test-access.log" combined
  TransferLog "/var/log/httpd/test-transfer.log"

  <Directory "/var/www/html/test">
        AllowOverride All

        <IfModule mod_rewrite.c>
          RewriteEngine On
          RewriteBase /
          RewriteRule ^index\.html$ - [L]
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule . /index.html [L]
        </IfModule>

  </Directory>

  ProxyRequests Off

  <Proxy *>
    Order deny,allow
    Allow from all
  </Proxy>

  ProxyPass /api http://localhost:8080/api/v1
  ProxyPassReverse /api http://localhost:8080/api/v1


</VirtualHost>

image1

  • Your requests have v1 in the URL, and you map /api to http://localhost:8080/api/v1. I would assume that this results in requests like /api/v1/v1/auth in the backend. I would remove the /v1 from the Proxy* directives. – Gerald Schneider May 18 at 8:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.