Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Redirecting a Healthcheck endpoint to REST endpoint with query params

Avatar

Level 3

Hi all,

 

We have some prefill services running on our AEM stack, we want to check the server health by prefilling a sample template with just a field. This service is a REST endpoint and the we make GET requests to it. I was trying to setup a dispatcher redirect

something like 

 

RewriteRule /healthcheck /bin/servlet/?json_input={"metadata": {"fillable": true},"envelope": {"actions": {"action": {"id": "1234","formid": "108646","formversion": "00","form_data": {}}}}}

Tried some flags that prevent encoding [NE], [QSA] with no luck, the chars still get encoded.

Any help would be greatly appreciated.

Thanks,

Abhishek

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

2 Replies

Avatar

Community Advisor

Hi @kolluax 

If I understand your requirement correctly, you want to rewrite the `/healthcheck` URL to call the servlet `/bin/servlet` and pass JSON data. Please confirm if my understanding is accurate.

If this is the case, Apache's `RewriteRule` does not support sending JSON payloads directly. You would need to either encode the JSON string and pass it in the URL i.e., something like:

RewriteRule ^healthcheck$ /bin/servlet/?json_input=%7B%22metadata%22%3A%7B%22fillable%22%3Atrue%7D%2C%22envelope%22%3A%7B%22actions%22%3A%7B%22action%22%3A%7B%22id%22%3A%221234%22%2C%22formid%22%3A%22108646%22%2C%22formversion%22%3A%2200%22%2C%22form_data%22%3A%7B%7D%7D%7D%7D%7D [L,QSA]

Or, If the servlet accepts POST request, you need to pass the JSON data in request body.

Thanks,

Asutosh Jena

Avatar

Administrator

@kolluax Did you find the suggestion helpful? Please let us know if you need more information. If a response worked, kindly mark it as correct for posterity; alternatively, if you found a solution yourself, we’d appreciate it if you could share it with the community. Thank you!



Kautuk Sahni