Gossamer Forum
Home : Products : DBMan SQL : Discussion :

https and images

Quote Reply
https and images

I'd like to stop my browser complaining about insecure elements (http:// image links), when I open DBMan via https://.

In template globals, I put "protocol" with the following sub:

sub {
my $tags = shift;
my $port = ($ENV{'SERVER_PORT'});
if ($port eq 80) { return "http"; }
if ($port eq 443) { return "https"; }
return $port;

In my header template, I put:

<%if protocol eq http%>
<img src="http://www.yourdomain.com/images/someimage.jpg">

<%if protocol eq https%>
<img src="https://www.yourdomain.com/images/someimage.jpg">

Quote Reply
Re: [olivers] https and images In reply to
Hello again

I have noticed that the same thing could also be accomplished via another environmental variable: $ENV{'HTTPS'}. When you're connecting to an SSL page, the value of $ENV{'HTTPS'} is 'on'.