We have a java servlet based application (very old code base), which is served with tomcat 8 with Apache httpd 2.4.43 and mod_proxy. Application has some static assets (CSS, CS, IMAGES) bundled with the java web application.
I am trying to modify the Header cookie for these assets by adding apache rule, but it seems, may be this is not working as the files are not within apache level ?
<FilesMatch ".(js|css)$">
Header edit Set-Cookie (.*) "$1;HttpOnly;Secure;SameSite=Strict"
</FilesMatch>
I tried adding the rule, without FilesMatch condition and it worked, but that's not what I need.
Any thoughts on how to get this done on Apache level. Here is excerpt from the httpd conf
<VirtualHost *:443>
DocumentRoot "/apps/httpd/htdocs1"
ServerName www.mydomain.com
ServerAlias mydomain.com
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/version$
RewriteRule ^/.*$ /version.html [R=301,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=302,L]
<Proxy balancer://${HOSTNAME}-http-cluster>
Header add Set-Cookie "MYAPP_SESSION=jacplus.%{BALANCER_WORKER_ROUTE}e;path=/;"
BalancerMember http://myhost-002:31080 min=1 max=1000 loadfactor=1 retry=1 timeout=240 route=myhost-002
BalancerMember http://myhost-003:31080 min=1 max=1000 loadfactor=1 retry=1 timeout=240 route=myhost-003
</Proxy>
ProxyPass / balancer://${HOSTNAME}-http-cluster/ stickysession=MYAPP_SESSION lbmethod=byrequests
ProxyPassReverse / balancer://${HOSTNAME}-http-cluster/ stickysession=MYAPP_SESSION
<Location /balancer-manager>
SetHandler balancer-manager
Order deny,allow
Deny from all
Allow from 10.25.0.0/16
</Location>
...
</VirtualHost>