Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

TransferHttpCacheModule to support different API urls from client and server #1934

@aeslinger0

Description

@aeslinger0

🚀 Feature request

What modules are relevant for this feature request?

  • aspnetcore-engine
  • builders
  • common
  • express-engine
  • hapi-engine
  • module-map-ngfactory-loader

Description

Currrently, TransferHttpCacheModule seems to only prevent duplicating API requests on the client if the API url matches exactly as it was on the server, but the server url could vary. For example, the client might call https://mydomain.com/api/someendpoint but the server could use an internal url such as http://mydockercontainer/api/someendpoint. Because the SSR API url and the API url that the client would make do not match, the client makes the call again.

Describe the solution you'd like

Could we configure the TransferHttpCacheModule to allow aliases for these API calls so that they are considered a match even if the domain names differ?

Describe alternatives you've considered

The workaround I'm using for local debugging is to have an entry in my hosts file that matches the Docker container name of my API app which points to 127.0.0.1. Then, both the client and server can call http://mydockercontainer/api/someendpoint and I can see that the duplicate API call is avoided on the client.

For the server, I could just use the same public API url for both client and server, but it could be an optimization if I could call an internal url on the server (avoiding the network), but still have it match the public API via some configuration to avoid the duplicate API call.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions