I'm trying to create a test form based on the example template "Basic" from AEM forms and changed the submit action to "Submit to rest endpoint" and typed in my servlet path into the field "URL for post request". But the submit results to an HTTP 500 error (but no error is shown in the log, only in the browser console). If I change the path to a complete URL, my servlet is called. But I don't want to use a complete url because this url depends on the current environment. So how I have to configure it?
"To post data to an internal server, provide path of the resource. The data is posted the path of the resource. For example, /content/restEndPoint. For such post requests, the authentication information of the submit request is used."
if anyone has the same question, I got this answer from the adobe technical support:
If the URL mentioned(“/bin/af-post”) resolves to a resource, relative URL would work. In this case, /bin/af-post does not resolve to a resource, hence the system expects a complete URL including hostname.
If your use-case is to use relative URL, can you rather mount a servlet on a resource ?
Having servlets on path like /bin could be troublesome on production systems from security and also dispatcher rules where you would need to whitelist these URLs.