Open knennigtri opened 3 years ago
Just bumping this thread since I seem to be having this issue as well. Luckily I only need it for testing a Servlet and in the meantime can create an HTML form as a workaround. I'd like to specify that the form action is the page the form exists on rather than the specified endpoint
@knennigtri @RyanScott96 ok I manage to solve it. Problem was with the CSRFFilter blocking the Post requests. Now it reaches the RPC handler properly.
@vladbailescu, @bpauli Could you please explain to me why it is not possible to post to the API endpoint directly from the browser? In our case we have an API endpoint which is public and we do not need the roundtrip through AEM.
So what we want is to be able to configure the API endpoint in the form component dialog and have the html form action attribute point to that endpoint instead of a resource in AEM.
I imagine we could have an additional actionType client-side. And in that case the form will output the configured endpoint directly in the form action?
Thanks for your support.
Expected Behaviour
When using the post form data actiontype, I should be able to set the
action
attribute of the form. The result should be:Actual Behaviour
Actual behavior ends up setting the action the same as the current page:
Reproduce Scenario (including but not limited to)
/content/us/en.html
drag and drop a form containeraction
attribute, but this does not seem to occur.Platform and Version
Cloud Service: 2021.2.4944.20210221T230729Z-210128
Logs taken while reproducing problem
Looking deeper into this, the component persists an
action
property to the JCR as expected. The HTML and json output have theaction
value = /content/us/en.htmlTo me this indicates that there might be something wrong with the Sling Model. Based on my limited knowledge on how this ContainterImpl.java works, it seems like the code does not get the
action
property from the jcr. https://github.com/adobe/aem-core-wcm-components/blob/master/bundles/core/src/main/java/com/adobe/cq/wcm/core/components/internal/models/v1/form/ContainerImpl.java#L102....
...