I am working with apache server and I would like to add headers conditionally.
If the URI matches a specific regular expression, I would like to add an Access-Control-Allow-Origin: * header. What is a good way to do this?
What I have tried so far:
I added the code called by the request handler using apr_table_add(rq->headers_out, "Access-Control-Allow-Origin", "*") . But it seems that Apache is breaking the header before sending a response whenever the Content-Type: application/x-javascript header is also set. Is this the wrong way to do this? Why did Apache split the header?
I heard mod_headers suggestions. Does mod_headers have the ability to place headers based on regular expression matching with the request URI?
dinosaur
source share