Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to rewrite/redirect properly :redirect parameter in Form Container

Avatar

Level 1

In AEMaaCS, I have a form container that sends emails with set up with "Thank You Page" parameter, which gives me this component configuration:

{
  "redirect": "/content/mywebsite/form",
  "subject": "Hello",
  "sling:resourceType": "core/wcm/components/form/container/v2/container",
  "actionType": "foundation/components/form/actions/mail",
  "action": "/content/usergenerated/mywebsite/formcq-gen1642504415838/",
  "jcr:primaryType": "nt:unstructured",
  "from": "test@test.com",
  "mailto": "test123@test.com",
  "id": "form"
  }

Now, when I submit the form, the form sents :redirect parameter as /content/mywebsite/form.html, so this is unmapped link (my JcrResourceResolverFactory settings will transform it to /form/). Finally, what is happening is the redirection returned to the browser leads to /content/mywebsite/form.html?status=200, which gives me 404 because I have different rewriting rules on dispatcher.

Is there a way to set up redirection properly? I see that the model does not map the redirect parameter whatsoever, should I add some configuration to the service that rewrites other parameters like a:href etc? I am worried this does not work well, because I have another parameter (:formstart) which should not be rewritten in my opinion.

Many thanks for your help!

 

0 Replies