Forum Moderators: phranque

Message Too Old, No Replies

Apache + mod_ssl https Images Problem

Images are broken in web page but not when viewed alone...

         

physics

10:55 pm on Feb 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I'm running apache 1.3.29 on RedHat Linux 9.0 with mod_ssl 2.8.96 and openssl version 0.9.7c. Right now ssl is working in the sense that I can visit
[myserver.com...]
and the page loads. test.html is a test page that just has some text and an image call <img src="/foo/myimage.jpg">
However, the image is broken. This happens both in MSIE and Opera.
If you view the image alone by visiting
[myserver.com...]
it *does* work.
I also tried
<img src="https://www.myserver.com/foo/myimage.jpg">
which didn't work either.

Some people have suggested checking httpd.conf and I've gone through it with a fine toothed comb. Notably I have the lines


SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL

SetEnvIf User-Agent ".*MSIE.*" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0


Which are sometimes quoted as possible trouble makers for images in https.
Any suggestions would be great!
If I can get this working the plan is to celebrate and then post how I installed apache, mysql, php, openssl and mod_ssl on RH 9 (and fixed this little bug).

physics

11:20 pm on Feb 19, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doh! It was my fault after all. I have a .htaccess which includes lines to try to prevent bandwidth theft with


RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http://myserver.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.myserver.com/.*$ [NC]
RewriteRule .*\.jpg$ - [G]

and needed to add


RewriteCond %{HTTP_REFERER}!^https://myserver.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^https://www.myserver.com/.*$ [NC]

Oh well, maybe this post will help a future .htaccess user some day :)

jdMorgan

4:23 pm on Feb 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



physics,

Here's something for your trouble:


RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER} !^https?://(www\.)?myserver\.com [NC]
RewriteRule \.jpg$ - [G]

That will handle all of your domain variants with a single RewriteCond line, and protect you from a potential malfunction if a Port number is appended to the hostname. Also, a couple of minor efficiency tweaks to the regex patterns.

Jim

physics

5:45 pm on Feb 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sweet. Knew there must be a better way. Thanks!