Is there anyway to proxy forwarding 3rd party URLS present in CQ page ?
Solved! Go to Solution.
Views
Replies
Total Likes
Ok, you're doing some AJAX requests, which should reach out for external servers; but instead you want them to be requested from AEM and AEM should act as a proxy to those external servers. Is that correct?
No, I am not aware of any default proxy components you could use. It's a quite specific usecase and it is very hard to implement it in a general way, as you always have the risk to create an open proxy. You could implement a rule on the loadbalancer or a HTTP webserver (like Apache httpd) to forward these requests directly to the other servers instead of AEM.
My question would be, why these 3rd party requests should be made to AEM instead of the other servers directly.
Kind regards,
Jörg
Views
Replies
Total Likes
Hi,
can you please elaborate a bit? What do you want AEM to do?
kind regards,
Jörg
Views
Replies
Total Likes
Well this is how we achieved it.
We created reverse proxy on our apache webserver, below is what we configured for external REST calls:
RewriteRule ^/proxyextserv/(.*)$ http://127.0.0.1:8080/ext/application/$1 [P,QSA]
ProxyPass /proxyextserv/ http://127.0.0.1:8080/ext/application/
ProxyPassReverse /proxyextserv/ http://127.0.0.1:8080/ext/application/
Doing so, now the pattern to call external application from ajax calls remains same in JS which is /proxyextserv/param1/param2 which gets rewritten at apache to following external call http://127.0.0.1:8080/ext/application/param1/param2
- Runal
Views
Replies
Total Likes
We have some ajax calls from Javascript present in AEM. I want the ajax URLs(external server) to be relative and still work inside AEM
Views
Replies
Total Likes
Ok, you're doing some AJAX requests, which should reach out for external servers; but instead you want them to be requested from AEM and AEM should act as a proxy to those external servers. Is that correct?
No, I am not aware of any default proxy components you could use. It's a quite specific usecase and it is very hard to implement it in a general way, as you always have the risk to create an open proxy. You could implement a rule on the loadbalancer or a HTTP webserver (like Apache httpd) to forward these requests directly to the other servers instead of AEM.
My question would be, why these 3rd party requests should be made to AEM instead of the other servers directly.
Kind regards,
Jörg
Views
Replies
Total Likes
The problem is we don't want to hard code the external server host and port in the html. Calls will be made from AEM page. This is for the author so that the page will show the data from ajax calls
Views
Replies
Total Likes
In that case I would recommend to use either the loadbalancer (assuming it has L7 capabilities) or the webserver as a proxy.
Jörg
Views
Replies
Total Likes
So is your concern hard coding or what happens at runtime? If your concern is hard coding then in addition to Jörg's suggestion of using an load balancer or a web server as the proxy you could also manage the host and port names in AEM (either as an author managed value or as an OSGI configuration). Then you make sure you feed the hostname and port number into your JavaScript functions from the AEM page when they are called an you don't have to hard code anything.
Views
Replies
Total Likes
Views
Likes
Replies