AJAX-call from JIRA Service Desk Portal for logged in users not agents

Using one of the provided hooks, you can extend JIRA Service Desk Portal. Having configured access to JSD Portal for anybody, it is not possible to make AJAX-calls in order to get/set values: http-302 redirects are forced to http://localhost:2990/jira/servicedesk/customer/portal/1. it works fine for logged in JSD agents.

What has to be done to successfully process AJAX-calls on JSD Portal for logged in user but not agents?

Only solution I have found: develope a REST service with anonymous access enabled and call that instead of a servlet via AJAX outside JSD Portal.

Maybe [JSDSERVER-3962] JSD docs need to mention customer context prominently - Create and track feature requests for Atlassian products. helps