Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allowing hotlinking to images - Apache 1.3

Status
Not open for further replies.

dummy11

Technical User
Jun 13, 2007
6
0
0
NL
I can't hotlink to image files on my server from other sites.

Does Apache block this by default? If so, what do I have to modify to allow it?

I tried setting the Rewritengine to 'off' in my httpd.conf file but this didn't seem to make any differnce.

I run Apache 1.3 on Mac OS 10.4.9.
 
Are these files and directories accessible by apache? You may have to create a directory container for the directories in question in httpd.conf to allow web access to those directories. What happens if you browse directly to one of those files?



 
Yes, they are accessible, I can access all of them from a normal browser from any computer with an internet connection. The files are in the 'documents' folder of the Apache webserver. The issue only occurs when I try to hotlink to them from another site on the internet.
 
Hi

This is the most important for debugging :
RhythmAce said:
What happens if you browse directly to one of those files?
When you answer it give us details about the HTTP response headers of the server. You can see the HTTP headers with add-ons :
[ul]
[li]FireFox - Live HTTP Headers[/li]
[li]Explorer - ieHTTPHeaders[/li]
[/ul]

Feherke.
 
OK, I installed the Firefox plugin. When I browse directly to the file (I am doing this from the intranet), it displays fine and I get the following info from the plugin:



GET /breakup.jpg HTTP/1.1

Host: 10.0.0.3

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

If-Modified-Since: Tue, 12 Jun 2007 00:55:43 GMT

If-None-Match: "4d9a7e-146e5-466def0f"



HTTP/1.x 304 Not Modified

Date: Thu, 14 Jun 2007 13:43:25 GMT

Server: Apache/1.3.33 (Darwin)

Connection: Keep-Alive, Keep-Alive

Keep-Alive: timeout=15, max=99

Etag: "4d9a7e-146e5-466def0f"


Thanks for your help so far...
 
Hi

The important one is when you hotlink and not receive the file. :)

And clear your cache previously, or manage in other ways ( like reloading with Ctrl-Shift-R ) to not get the 304 response.

Feherke.
 
Can you connect AT ALL to the Mac from outside of your LAN (ssh, ftp, afp, etc)?

I suspect not.

10.0.0.3 is a NAT address, is it not?

You would need to have port forwarding set up on your router AND you would need to make the request to the WAN address not the NAT (LAN) address. If you have a have dynamic DNS you'll have to work around that too.
 
Ok, this is what is generated when I make the request from the site I wish the hotlink to appear on:





POST /board/write.php HTTP/1.1

Host: b3ta.com

User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Referer:
Cookie: __utmz=108610321.1169558623.1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none); session_cookie=6528.8d5e08729f7f4c2d4d5547baf9bafff2; __utma=108610321.1203775495.1169558623.1181761077.1181925219.10; __utmb=108610321; __utmc=108610321

Content-Type: application/x-
Content-Length: 137

parent=0&done=0&verify_code=3013864923&subject=test&message=%3Cimg+src%3D%22http%3A%2F%2F
HTTP/1.x 200 OK

Date: Fri, 15 Jun 2007 16:39:51 GMT

Server: Apache

Accept-Ranges: bytes

X-Powered-By: PHP/4.3.2

Set-Cookie: session_cookie=6528.8d5e08729f7f4c2d4d5547baf9bafff2; expires=Sat, 14-Jun-2008 16:39:52 GMT; path=/; domain=b3ta.com

Keep-Alive: timeout=15, max=100

Connection: Keep-Alive

Transfer-Encoding: chunked

Content-Type: text/html; charset=iso-8859-1

----------------------------------------------------------




GET /grief.jpg HTTP/1.1

Host:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

Accept: image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Connection: keep-alive

Referer:


HTTP/1.x 501 Not Implemented

Server: WindWeb/2.0

Connection: close

Basic realm="Home Gateway"

Content-Type: text/html


------------


(PS - phripley I can connect to my mac via HTTP/SFTP/SSH from outside and all my relevant ports are forwarded. My webserver works fine and my site is visible on the internet.)
 
Hi

That is abit messy. If HTTP authentication is configured for that resource so the [tt]WWW-Authenticate[/tt] header is sent back, then the response code has to be 401.
Code:
HTTP/1.x [red]401 Unauthorized[/red]
Server: WindWeb/2.0
Connection: close
[URL unfurl="true"]WWW-Authenticate:[/URL] Basic realm="Home Gateway"
Content-Type: text/html
I suppose your browser does not display any authentication window when that happen. Which is correct, because it was not instructed to do so.

So either is a buggy server-side application installed, or WindWeb is buggy.

Feherke.
 
Hi

Almost forgot. Another possibility is that the bug is smaller and the web server is configured to refuse GET requests. But in that case is useless to send the [tt]WWW-Authenticate[/tt] header.

Feherke.
 
I did get an authentication window once 2 days ago. I cannot remember exactly what I did to reproduce this. The window asked for a passphrase to the realm 'homegateway'.

Do you know if WindWeb might be something my router is running? My router software is called Conexant Hasbani I think.

Thanks for your time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top