Due to certain requirements, I need to make the Angular application make all the requests on the server and not on the client/browser.
I have enabled SSR (Server-Side Rendering) on my angular application using Angular Universal expecting all the http requests to be made by the server. I found out later that after the server is done rendering the pages and the application, the client version of the application takes over and all the calls are made on the client's browser which is not what I wanted.
Is there a way that uses Angular Universal or any other package/method to make all the requests in Angular to be made by the server only?
Link to solution that I have tried that didn't work: text
You should use TransferState and save the server state and check that state before sending requests to the API. Read about TransferState and of course this article can help you.
Transfer State
you can also use TransferHttpCacheModule and add it to app module that cause the client side automatically ignores Get requests that are called on the server side.
UPDATE: In Angular version 16, which was released today, the httpclient module has been updated and it will now cache requests made on the server to avoid re-fetching that same data again on the client.
see this article