Networking Forums

Networking Forums > Computer Networking > Linux Networking > Looking for a specific HTTP Header

Reply
Thread Tools Display Modes

Looking for a specific HTTP Header

 
 
fritz-bayer@web.de
Guest
Posts: n/a

 
      01-06-2005, 12:28 PM
Hi,

I have the following problem, which I want to solve in a particular
way, without using http redirects like 301 or 302.

Let me first describe the Problem:

I have a browser that requests a page, say
"/exampledirectory/example.html".

The response to that request should be data from a different document
located at "/whatever.html", but it could be from any other location on
the server.

That document contains links, which are relative to the location of it
(for example image/picture.gif) and point to other resources.

Now, my question is if there are http headers, which the server can
return so that the Browser will end up like this:

In the browser the uri "/exampledirectory/example.html" gets displayed.
The content displayed in the browser is the HTML from "whatever.html"
and the links in it are not broken.

The later thing is the tricky part. Getting the content to the browser
from is possible.

However, all links are broken, because the Browser thinks that it is in
the directory "/exampledirectory/", when it is in fact in "/".

I know this can be solved using redirects but that is not what I'm
looking for. I'm looking for a http response header, which tells the
client that the content returned has to be treated as if the document
was fetched from the root directory "/".

Do you know if such a http header exists (as I said I don't want to use
the Location Header or any other form of redirects. The client should
NOT be forced to iniate another request to get the document.

 
Reply With Quote
 
 
 
 
Davide Bianchi
Guest
Posts: n/a

 
      01-06-2005, 12:34 PM
On 2005-01-06, fritz-(E-Mail Removed) <fritz-(E-Mail Removed)> wrote:
> The response to that request should be data from a different document
> located at "/whatever.html", but it could be from any other location on
> the server.


If I Understood Correctly, you want to proxy a page changing his
content. In Apache, mod_proxy_html is used to do so.

Davide

--
National Weather Service advice for those threatened by severe
thunderstorms: "Go inside a sturdy building and stay away from
WINDOWS!" -- Ben Bullock
 
Reply With Quote
 
fritz-bayer@web.de
Guest
Posts: n/a

 
      01-06-2005, 01:47 PM
Hi Davide. Thanks for the advice but I'm looking for a more general way
to solve my problem.

I'm looking for a http response header or a client request header,
which solves my problem.

But I think you are right, when you are saying that I'm proxying that
uri. The content is somewhere else on the site.

I would need a header, which communicates this to the client when
returning the response.

 
Reply With Quote
 
Thornton
Guest
Posts: n/a

 
      01-07-2005, 05:47 AM
If the content is elsewhere on the site and you are using Apache, you
can use an internal rewrite. This happens before the content handling
phase so it is completely transparent to the client -- no special
headers.

The mod_rewrite documentation has all sorts of information on how
internal rewrites work and where they can be used (vs. proxy or a
client redirect).

This is a generic internal mechanism to Apache, so if mod_rewrite can't
do what you want (and given the power of mod_rewrite, this is fairly
rare) you can write your own handler in mod_python, mod_perl, or C that
does the trick.

You can solve the broken links issue with either more mod_rewrite rules
or by writing a content filter that fixes broken links.
If you are looking for a simple answer, use a symlink.

thornton

 
Reply With Quote
 
fritz-bayer@web.de
Guest
Posts: n/a

 
      01-07-2005, 07:35 AM
Hi Thornton,

thanks I could do it that way, but it has to be in a product independet
manner. I basically want to return a document at another location.

That is done by the software itself. But then the client needs to know,
that the location has actually changed.

Usually one can do this using a 302 or 302 but this requires another
request from the user.

Aren' there any response headers in the hhtp 1.1 protocoll, which will
tell the client, that the content returned is the one for the document,
but that the location is different.

Then the client could display the original uri in the browser url and
display the content of the other file. More important so it could
actually handle the links correctly.

Does somehting like this exist? What is with the header "Location
Content" or using a "Location" for example with a 200 ok ?

 
Reply With Quote
 
Thornton
Guest
Posts: n/a

 
      01-07-2005, 02:26 PM

I don't think there is anything in the HTTP specification, though with
HTTP pipelining the client should request the redirected content on the
same TCP socket connection which should increase performance.

The bigger question might be, even if there was what would you expect
the client to do with the new location information (other than display
the correct URI)? I don't know of any browsers that update bookmarks
automatically from a 301 code, even though they probably should.

With some rather simple code, you probably want to send a 301 to the
user, send them to the right location AND send a queue to the actual
human user that the location they used is obsolete.

You might want to ask on the Apache forums or if you are using mod_perl
or the like one of the forums where they discuss HTTP more
specifically.

thornton

 
Reply With Quote
 
 
 
Reply

« ntpd | Group ACLs »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
forward http://p2p.mydomain.com to http://mydomainIP:50001/gui/index.html, is that possible? aticatac Network Routers 1 11-13-2007 12:00 AM
Is a HTTP header a clear text? Sonny Linux Networking 17 10-25-2007 10:16 AM
Help on extracting http header Sonny Linux Networking 1 09-17-2007 07:07 AM
How do i Re-direct specific http request to another gateway DK Linux Networking 1 01-25-2006 09:50 PM
linux cooked header to ethernet header conversion makwak Linux Networking 0 05-10-2005 12:36 PM



1 2 3 4 5 6 7 8 9 10 11