Dispatcher filter to allow only mapped post content | Community
Skip to main content
Level 3
February 24, 2021
Solved

Dispatcher filter to allow only mapped post content

  • February 24, 2021
  • 1 reply
  • 945 views

Hi All,

I would to like to deny all the post methods by adding below filter 

/0001 {type "deny" /method "POST" }

Then , I have 100+websites running in my AEM application,so how to allow the all configured mapped content paths(present in my application) by adding filter conditions.

Could you please suggest on this and let me know your thoughts .

 

Thanks  in Advance.

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 davidjgonzalezzzz

@keerthi97 there is no magic bullet for this, since there are any number of ways the HTTP POST endpoints maybe have been defined in AEM.

 

In the best case, all your HTTP POST endpoints are bound with well-known Sling selectors -- so like, HTTP POST /content/site-1/page.my-custom-submisssion.json, where `my-custom-submission` is the identifying selector.

 

If you have a set of well-known selectors, you can allow POST whose URLs contain that Selector or Path pattern .. some examples are here  [1]

 

If you have a mix of POST endpoints (resource-type based servlets, path-based servlets, script-based servlets, or even OOTB) then you'll have to go through them and figure out the best set of filters are for what your 100+ sites are using. Hopefully, you'll be able to identify some patterns that let you define allow a single rule per logical endpoint. Definitely think about using the /path configuration that allows patterns (regex) or matching on selectors if you can.

 

[1] https://github.com/adobe/aem-project-archetype/blob/master/src/main/archetype/dispatcher.cloud/src/conf.dispatcher.d/filters/default_filters.any

1 reply

davidjgonzalezzzzAdobe EmployeeAccepted solution
Adobe Employee
February 24, 2021

@keerthi97 there is no magic bullet for this, since there are any number of ways the HTTP POST endpoints maybe have been defined in AEM.

 

In the best case, all your HTTP POST endpoints are bound with well-known Sling selectors -- so like, HTTP POST /content/site-1/page.my-custom-submisssion.json, where `my-custom-submission` is the identifying selector.

 

If you have a set of well-known selectors, you can allow POST whose URLs contain that Selector or Path pattern .. some examples are here  [1]

 

If you have a mix of POST endpoints (resource-type based servlets, path-based servlets, script-based servlets, or even OOTB) then you'll have to go through them and figure out the best set of filters are for what your 100+ sites are using. Hopefully, you'll be able to identify some patterns that let you define allow a single rule per logical endpoint. Definitely think about using the /path configuration that allows patterns (regex) or matching on selectors if you can.

 

[1] https://github.com/adobe/aem-project-archetype/blob/master/src/main/archetype/dispatcher.cloud/src/conf.dispatcher.d/filters/default_filters.any