I am using Apache server for hosting my Angular application. So I enabled the single page application support with he following configuration
<Location / >
RewriteEngine on#
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.html [L]
</Location>
Also I have a backend. I am using mod_proxy to proxy it with Apache.
ProxyPass "/api" "http://127.0.0.1:8081/api"
ProxyPassReverse "/api" "http://127.0.0.1:8081/api"
But when I use both these configurations, I am unable to call any APIs. All calls return index.html.
May I know what is wrong and how to fix it?
Thanks @Dusan Bajic for the comment.
Now, I have the following config, and it works.
ProxyPass "/api" "http://127.0.0.1:8081/api"
ProxyPassReverse "/api" "http://127.0.0.1:8081/api"
<Location / >
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/api
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png)$ [NC]
RewriteRule . /index.html [L]
</Location>