0

I have SSL setup on a server. Using sling:Mappinng I can serve forms over https.

However after user visited any of the forms they remain using site over https.

How can I make sure that only forms are served over https and rest of the site over http?

repository structure is as follows:

mysite.com
    +--content(should to be over http)
       +--forms(should be over http)
           +--form1(needs to be over https)
                +--form1ThankYou(should be over http)
           +--form2(needs to be over https)
                +--form2ThankYou(should be over http)
       +--moreContent1(should be over http)
       +--moreContent2(should be over http)
       +--moreContent3(should be over http)

I couldn't find any clear documentation on this will be grateful for any help.

Thanks

Ok so here is what I tried

map
 +--http
      +--example.com
             +--forms
                  (sling:match "forms/(.*).html")
                  (sling:redirect "https://example.com/forms/$1.html)

This works

map
 +--https
      +--example.com
             +--content1
                  (sling:match "content1/(.*).html")
                  (sling:redirect "http://example.com/content1/$1.html)

Doesn't Work

Any ideas?

Thanks

blueby
  • 71
  • 2
  • 9

1 Answers1

1

The mapping tree starts with the root-level mapping describing the schema name (http or https). In your example, above the mysite.com you have a node named http or https. Create a second root-level mapping, so you have two mapping subtrees, one for the http and second for the https:

+--http
|   +--mysite.com
|       +--content
+--https
    +--mysite.com
        +--content
Tomek Rękawek
  • 9,204
  • 2
  • 27
  • 43
  • If I do that can I match everything that is not under forms something like: !forms/(.*).html? Or do I have to create a separate set for each node like moreContent1/(.*).html and moreContent1/(./*)/(.*).html and moderContent2 .... If I match everything under content under https node am I not going to end-up with redirect loop for forms? – blueby Apr 09 '15 at 08:12
  • There is no bang (`!`) operator in the regex subset available in the `sling:match`. You may try use the order of the mappings to achieve desired effect. – Tomek Rękawek Apr 09 '15 at 10:16