Attempting to get my site to comply with the limitations of an edge content delivery network, I have been forced to push my security certificate root from
https://www.mysite.com to the subdomain
https://www.secure.mysite.com . I am now contemplating what seems to be a novel way I can mirror the content from my nonsecured domain through my secure subdomain. Utilizing several mod_rewrite commands in my apache configuration, I have successfully set it up to redirect all
https://*.com requests to my server to prefix the request to
Now here comes the part I wanted to invite some discussion on. This is my outline for my idea.
Unlike the rest of my server, any request through the secure subdomain will be handled with a different ErrorDocument for 404 requests. Instead of simply displaying a 404 error, this page will be responsible for trying to find an eligible 'proxy' point on the base domain. Here's an example:
- The user requests
- The mod_rewrite changes the original request to
- The server is unable to find
/site/walrus.phpin the secure subdomain, and it invokes the 404 handler for the secure subdomain
- The 404 ErrorDocument (a php script) strips the secure part out of the requests, rendering
- The script attempts to use
file_get_contents()to get the contents of
- If the script finds
http://mysite.com/site/walrus.phpis an existing resource, it echoes the contents of that file as its own contents. Otherwise, having been unable to find the resource, it proceeds to issue redirect headers to the normal 404 ErrorDocument that applies to the rest of the server.
So, what comments can you make about this? Has it already been done before, are there resources or examples of this kind of thing for me to look at while I do this?