Sunday, April 3, 2011

Swiching between Http or Https (based on parent directory)

I have a direcory for the members area.

All the files within that directory should be treated by https.

All other files outside the specific dir should be treated by http.

How can i automate the redirecting from http and https and vice versa?

Btw, the links are relative.

From stackoverflow
  • Best thing I can think of to cover humans would be to rewrite the urls using javascript. If they are all relative then it shouldn't be too tricky.

    I'd note that mixing sites like this have some drawbacks, principally browsers don't like HTTPS pages with insecure HTTP requests involved. A better plan might be to make everything relative and only kick over to https mode once you need to hit the https section.

    I can see a few ways to do this using IIS, but those options really depend on how much you can muck with the IIS configuration and what sorts of resources you have.

  • This sounds like it might best be managed through HTTP server configuration. E.g. mod_rewrite and similar.

    Try asking on http://serverfault.com/

  • You can use the SecureWebPages assembly and web.config entries from Switching Between HTTP and HTTPS Automatically: Version 2. It's a nice piece of kit, I've used it in the past to automatically switch login and admin pages to https

0 comments:

Post a Comment