sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-urlrewriter] 06/10: SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
Date Tue, 07 Nov 2017 10:24:14 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.urlrewriter-0.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-urlrewriter.git

commit 029dd0601bd723e3ba69faab4220fa96f964f127
Author: Oliver Lietz <olli@apache.org>
AuthorDate: Sat Feb 14 16:52:22 2015 +0000

    SLING-3518 add a multipurpose filter based on Tuckey's UrlRewriteFilter
    
    * add example for setting CORS headers
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/urlrewriter@1659812
13f79535-47bb-0310-9956-ffa450edef68
---
 README.md | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/README.md b/README.md
index be81b6b..8e996bd 100644
--- a/README.md
+++ b/README.md
@@ -17,3 +17,25 @@ example for setting a Cache-Control header:
       </rule>
     </urlrewrite>
 
+example for setting CORS headers:
+
+    <?xml version="1.0" encoding="UTF-8"?>
+    <!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 4.0//EN" "http://www.tuckey.org/res/dtds/urlrewrite4.0.dtd">
+    <urlrewrite>
+      <rule>
+        <note>
+          http://www.w3.org/TR/cors/
+          https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
+          http://fetch.spec.whatwg.org
+          http://enable-cors.org
+          http://www.html5rocks.com/en/tutorials/cors/
+        </note>
+        <condition type="header" name="Origin">.*</condition>
+        <condition type="header" name="Access-Control-Request-Method">.*</condition>
+        <condition type="header" name="Access-Control-Request-Headers">.*</condition>
+        <set type="response-header" name="Access-Control-Allow-Origin">%{header:Origin}</set>
+        <set type="response-header" name="Access-Control-Allow-Methods">%{header:Access-Control-Request-Method}</set>
+        <set type="response-header" name="Access-Control-Allow-Headers">%{header:Access-Control-Request-Headers}</set>
+        <set type="response-header" name="Access-Control-Allow-Credentials">true</set>
+      </rule>
+    </urlrewrite>

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message