Form post to absolute action url | Community
Skip to main content
Level 2
August 5, 2019
Solved

Form post to absolute action url

  • August 5, 2019
  • 1 reply
  • 1185 views

Hi,

We need to be able to use an absolute action url in the AEM form component, this way we can post to a different domain than the one that is used to open the AEM page with the form on.

We already managed to set a custom, absolute action url to the form container.

However posting the form does not work; a blank page is shown after the submit and nothing is shown in the logs.

We think maybe a filter blocks this submit for security reasons, but we're not able to determine which one (already disabled the referrer filter for post, but this did not help)

Example of the way we are currently testing this:

<form method="POST" action="http://author.localhost.com:4502/bin/forms/post" id="test-whitelist" name="test-whitelist" enctype="multipart/form-data" class="cmp-form aem-Grid aem-Grid--12 aem-Grid--default--12">

    <input type="hidden" name=":formstart" value="/content/test/en/TestFormPost1/jcr:content/rootLayoutContainer/root/responsivegrid/container">

    <input type="hidden" name="_charset_" value="utf-8">

    <input type="hidden" name=":redirect" value="http://localhost:4502/content/test/nl.html">

    <div class="text aem-GridColumn aem-GridColumn--default--12">

<div class="cmp-form-text">

    <label for="form-text-749542657">Text input field</label>

    <input class="cmp-form-text__text" data-cmp-hook-form-text="input" type="text" id="form-text-749542657" name="text">

</div></div>

<div class="button aem-GridColumn aem-GridColumn--default--12">

<button type="SUBMIT" class="cmp-form-button">Submit</button>

</div>

</form>

   

For testing we're opening the page at: localhost:4502, posting to author.localhost.com:4502 and redirecting back to localhost:4502

When we keep the domain of the page and the action url the same, the submit works correctly.

AEM Version: 6.4.4

Nb: We're using the basic form components (i.e. not adaptive forms)

In practice we will be posting to a sub domain.

Any help is much 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 johanr79164415

found the culprit: it was the Adobe Granite Cross-Origin Resource Sharing Policy (of course )

1 reply

johanr79164415AuthorAccepted solution
Level 2
August 6, 2019

found the culprit: it was the Adobe Granite Cross-Origin Resource Sharing Policy (of course )

maryani
Level 2
March 17, 2023

What are the configurations that needs to be added for Adobe Granite Cross-Origin Resource Sharing Policy , Please let me know