Skip to main content
kaikubad
Community Advisor
Community Advisor
February 9, 2023
Solved

Dispatcher is not caching when Basic Auth is enabled

I have enabled basic auth from dispatcher for our dev and stage server.
But its not caching content when basic auth is enabled.

If I disable basic auth then it works. For basic auth I have added following code on dispatcher

<Directory "${PUBLISH_DOCROOT}">
<If "req('Host') =~ /(dev|stage)\.example\.com/">
AuthType Basic
AuthName "Restricted Content"
AuthUserFile /etc/httpd/.htpasswd
Require valid-user
</If>
<Else>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Else>
</Directory>
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
ChitraMadan
ChitraMadanAccepted solution
Community Advisor
February 9, 2023

Hi @kaikubad ,

 

You need to set /allowAuthorized "1" in your dispatcher config.

 

 

 

Thanks,

Chitra

6 replies

SivakumarKanoori
Community Advisor
Community Advisor
February 9, 2023

@kaikubad 

Did you check the below configuration is enable in your publish instance

(http://localhost:4503/system/console/configMgr/org.apache.sling.engine.impl.auth.SlingAuthenticator)

Translate
Thanks,Siva
kaikubad
Community Advisor
kaikubadCommunity AdvisorAuthor
Community Advisor
February 9, 2023

@sivakumarkanoori 

Its not the path I have chosen. and yes the configuration is enabled on publish.

Translate
mkaikubad
Umesh_Thakur
Community Advisor
Community Advisor
February 9, 2023

Can you validate you response headers for authorisation  and that perticular header is enable for caching or not in your dispatcher.any file.

Hope this helps

Umesh Thakur

Translate
kaikubad
Community Advisor
kaikubadCommunity AdvisorAuthor
Community Advisor
February 9, 2023

can you please explain more or provide a sample code ?

Translate
mkaikubad
ChitraMadan
Community Advisor
ChitraMadanCommunity AdvisorAccepted solution
Community Advisor
February 9, 2023

Hi @kaikubad ,

 

You need to set /allowAuthorized "1" in your dispatcher config.

 

 

 

Thanks,

Chitra

Translate