How do you configure mod_proxy_ajp to support CORS?

1k views Asked by At

I am running Apache with mod_proxy_ajp module. Apache is successfully reverse proxying requests to tomcat. The configuration is specified in the file /etc/httpd/conf.d/proxy_ajp.conf

ProxyPass /ajp-web-services ajp://ipaddress:8009/tomcat-web-services

Is it possible to configure mod_proxy_ajp module to set the header Access-Control-Allow-Origin to "*"? If so, how would you update proxy_ajp.conf to set a header?

Thanks,

Nathan

1

There are 1 answers

0
Nathan Reese On

Turns out this is super easy. The configuration does not occur in proxy_ajp.conf.

Add the following to /etc/httpd/conf/httpd.conf

<VirtualHost *:80>
  Header set Access-Control-Allow-Origin "*"
</VirtualHost>