0

I use the awesome front end optimizer fasterize.com , which requires www subdomain. Also I have a payment page that I would use HTTPS without using fasterize, so on another subdomain.

I use lighttpd, I already have a good redirection for all pages. I added subdomain and a rule for the payment page, like this :

$HTTP["host"] =~ "^payment\.domain\.com$" {
  url.redirect = ("^/(.*)$" => "https://domain.com/payment/")
}

$HTTP["host"] =~ "^domain\.com$" {
   url.redirect = ("^/(.*)$" => "http://www.domain.com/$1")
}

But the second rule catch the call of first one and I get http://www.domain.com/paymentpage/ which is not good because of missing HTTPS.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
Julien D
  • 103
  • 2
  • Have you read lighttpd's docs on [http to https](http://redmine.lighttpd.net/projects/1/wiki/HowToRedirectHttpToHttps)? I hope so since it is the first result on google for "lighttpd http to https". Assuming you have, was there something you didn't understand or that was unclear from it? – Macattack Jan 30 '14 at 19:22
  • It's not exactly my problem. I will edit to explain better. – Julien D Jan 31 '14 at 12:43

2 Answers2

1

Is there any reason you aren't just making everything https? Depending on what resources you load on the payment page, if any of them are insecure (http) you'll be getting warnings in the console or possibly not loading the resources at all.

$HTTP["host"] =~ "^payment\.domain\.com$" {
    # Redirect to the fully correct domain - www.domain.com - to avoid more redirects
    url.redirect = ("^/(.*)$" => "https://www.domain.com/payment/")
}

# Redirect any http requests for the payment domain
$HTTP["scheme"] == "http" {
    url.redirect = ( "^/payment/$" => "https://www.domain.com/payment/" )
}

$HTTP["host"] =~ "^domain\.com$" {
    url.redirect = ("^/(.*)$" => "http://www.domain.com/$1")
}
Macattack
  • 126
  • 1
0

Just to clarify and with no way to add a comment, Fasterize do support SSL : http://www.fasterize.com/en/faq Just ask the support team to install your certificate on Fasterize infrastructure.

-- stephane (CEO, Fasterize ;-)

stef
  • 1
  • Guys, I wanted to tell you your service is really cool! I edited my first post to avoid misunderstanding. Thanks for your intervention. – Julien D Feb 04 '14 at 21:52