Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: PSGI, Plack et.al.

by Anonymous Monk
on Oct 24, 2012 at 19:10 UTC ( [id://1000693]=note: print w/replies, xml ) Need Help??


in reply to Re: PSGI, Plack et.al.
in thread PSGI, Plack et.al.

Actually, it does not matter. HTTP or HTTPS, the underlying protocol is exactly the same. In Apache, a different <virtualHost> definition will correspond to each. What each one of them does, if need be, could be exactly the same. (If the FastCGI servers are static, the traffic from both VHosts could in fact be sent without error to the same pool. So it CAN be done, should you actually want to do it, and the Perl code does not have to know or care.

Replies are listed 'Best First'.
Re^3: PSGI, Plack et.al.
by McA (Priest) on Oct 24, 2012 at 20:28 UTC

    Hi,

    but you should not forget that there are circumstances where you want to know whether requests came via https or http. Just two examples:

    • You want to generate absolute URL in the response to reflect the currently used protocol.
    • You want to set the secure attribute on cookies when you know that the response is sent via https.

    Best regards
    McA

      A common? trick to avoid the protocol is a schemaless URL:

      # Instead of https://example.com/foo/bar # use //example.com/foo/bar

      This will use the same protocol as the origin.

      there are circumstances where you want to know whether requests came via https or http

      At least the Apache webserver sets up several CGI environment variables, the most obvious one is HTTPS set to on. It also adds a ton of environment variables starting with SSL_ describing many aspects of the SSL connection. The CGI 1.1 RFC 3875 leaves HTTPS unspecified, but allows the Apache behaviour.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1000693]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (2)
As of 2024-04-26 05:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found