AEM publisher as a middleware | Community
Skip to main content
Nandujee
Level 3
September 7, 2024
Solved

AEM publisher as a middleware

  • September 7, 2024
  • 2 replies
  • 1088 views

Hi Experts,

 

We are creating a dynamic component in AEM (SPA Angular) called the search widget component, which calls a third-party API. This call can be triggered from the browser, but the API requires an API key, which we don't want to expose in the network call. Therefore, we are considering triggering the call from the publisher as a servlet.

 

Is it recommended to use the publisher as middleware in this case?

 

Since this component is expected to handle significant traffic, with 200-400 TPS, relying on the publisher may not be ideal.

 

I understand that publishers are not designed to handle such activities. In this situation, what would be the ideal solution?

 

Your help is greatly appreciated!

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by AlbinIs1

My recommendation is to proxy the call from the CDN layer itself. You should be able to set the required API keys at the CDN level, which allows you to use the same DNS to invoke the APIs at the browser level. This approach also helps hide the API keys and prevents unnecessary traffic from reaching the AEM publish layer.

Please refer to https://medium.com/tech-learnings/implementing-cross-domain-cookie-handling-for-seamless-api-integra... for more details

Regards

Albin

https://myprofile.albinsblog.com

2 replies

sherinregi-1
Community Advisor
Community Advisor
September 9, 2024

Hi @nandujee 

In your case you can try the aem+ reverse proxy approach which can be used to redirect the request to 3rd party server through dispatcher without affecting your publisher 

 

 

 

refer the blog for impl details : https://techrevel.blog/2024/06/09/aem-reverse-proxy/

 

AlbinIs1Community AdvisorAccepted solution
Community Advisor
September 9, 2024

My recommendation is to proxy the call from the CDN layer itself. You should be able to set the required API keys at the CDN level, which allows you to use the same DNS to invoke the APIs at the browser level. This approach also helps hide the API keys and prevents unnecessary traffic from reaching the AEM publish layer.

Please refer to https://medium.com/tech-learnings/implementing-cross-domain-cookie-handling-for-seamless-api-integra... for more details

Regards

Albin

https://myprofile.albinsblog.com