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
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Issue using suffix in the URL

_SumitSinghal
Level 4
Level 4

Hi Team,

On publisher, requested url with suffix ( is dynamic which changes with environment so can't be made static ) is being blocked by dispatcher even after adding a rule to allow the request url.

Requested URLhttps://domain.com/bin/project/proxy.json/1.1/column/None/()/cms/dev/user

Rules tried : 

 

/1040 { /type "allow" /method '(GET|PUT)' /url "/bin/project/proxy.json*" }   

 

/1040 { /type "allow" /method '(GET|PUT)' /url "/bin/project/api-proxy.json*" /suffix "*" }

 

Any help will be highly appreciated .

1 Accepted Solution
asutosh_jena
Correct answer by
Community Advisor
Community Advisor

Hi @_SumitSinghal 

 

As I can see it's a path based servlet so it will not work. You will need to convert it into Resource Types based.

 

As per SLING documentation:

"path-bound servlets can only be registered to a path and not a resource type (i.e. no suffix handling)"

 

Please see the link below:

https://sling.apache.org/documentation/the-sling-engine/servlets.html#example-registration-by-path-1

 

Hope this helps!

Thanks!

View solution in original post

6 Replies
Arun_Patidar
Community Advisor
Community Advisor

Hi,

can you try with something like below

 

/type "allow"
/path "/bin/twitter/api-proxy"
/method '(get|put)'
/extension 'json'
/suffix '*'

 

_SumitSinghal
Level 4
Level 4

Hi Arun,

 

Thanks for sharing. 

I tried the rule which you shared but it gives me 404 error after deployment.

I found the issue is not with the filter rule but when I add RewriteRule with a passthrough to allow the requested URL it works.

/1040 { /type "allow" /method '(GET|PUT)' /url "/bin/project/api-proxy.json*" }
RewriteRule ^/bin/project/api-proxy.json/(.*)$ /bin/project/api-proxy.json/$1 [NC,PT,L]

 

kishorekumar14
Level 8
Level 8

Hi @_SumitSinghal ,

 

Just trying to understand, whether suffix will work for path bound servlets ?

asutosh_jena
Correct answer by
Community Advisor
Community Advisor

Hi @_SumitSinghal 

 

As I can see it's a path based servlet so it will not work. You will need to convert it into Resource Types based.

 

As per SLING documentation:

"path-bound servlets can only be registered to a path and not a resource type (i.e. no suffix handling)"

 

Please see the link below:

https://sling.apache.org/documentation/the-sling-engine/servlets.html#example-registration-by-path-1

 

Hope this helps!

Thanks!

View solution in original post

_SumitSinghal
Level 4
Level 4

Hi @asutosh_jena 

Thank you !

But using resourceType will not work in my use case . I found the solution using "/bin"path with suffix and it works as expected.