I have an Angular application deployed with an apache server on the same pod in the cluster. In my vhost file, I have a couple of directives, that I am using to proxy to my other backend applications in the cluster.
The issue that I am facing, is that I need to access one of my backend endpoints, through my frontend ui.
the host is: https://my-app my backend api is: api/backend/download
I need to use the following: https://my-app/api/backend/download. The issue is when I receive an error from my backend endpoint, it will display the json in the browser. I need to redirect to https://my-app/error-page.
What I tried up until now is using an ErrorDocument as follows:
<Location /api/backend/download> ...proxy setups ProxyOverride On ErrorDocuent 401 /error-page
But this keepts the url in the browser, which in turn will get picked up by angular wildcard, not the /error-page route I have defined.
I also tried RewriteRule as:
<Location /api/backend/download> ...proxy setups RewriteEngine On RewriteRule ^/download /error-page
But this as well doesn't seem to change the url in the broser. Does anyone have any ideea how can I redirect on 401 status code to my error-page route??
Thanks in advance