httpd-modules-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sindhi Sindhi <sindhi....@gmail.com>
Subject Re: Browser cookie and Apache server calls
Date Thu, 27 Jun 2013 10:13:11 GMT
Thanks a lot Sorin, with the information you provided I should be able to
get it working.
Thanks again!

On Thu, Jun 27, 2013 at 1:16 PM, Sorin Manolache <sorinm@gmail.com> wrote:

> On 2013-06-27 06:28, Sindhi Sindhi wrote:
>
>> If I clear the browser cache before I click on the hyperlink, I dont see
>> this issue. But I do not want to delete the cookies, because the business
>> logic used by the filter makes use of the cookies that are set. Also I may
>> not want to delete the cache everytime before I click on the hyperlink :(
>>
>> I added the below lines in httpd.conf file but still see that the page is
>> cached and hence no server call is made :(
>> LoadModule headers_module modules/mod_headers.so
>> Header set Cache-Control "must-revalidate, no-cache"
>>
>
> As a general advice, test your modules with a command line tool first.
> Thus you have a strict control of what you send in your request and you see
> what the server answers. Such a command line tool is "curl". It runs under
> Windows too. It allows you to locate the problem: is it that your module
> does not send the expected headers (Set-Cookie, Cache-Control, etc), or is
> it that the browser does not send them (the Cookie header for example).
> With curl you can specify which headers to send, which cookies, and you can
> simulate browsers by sending all kind of cache-related headers
> (If-Modified-Since, If-Match-None, etc).
>
> Check http://www.w3.org/Protocols/**rfc2616/rfc2616-sec14.html#**sec14<http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14>for
an explanation of all http headers, especially the cache-related ones
> (Cache-Control, Expires, Last-Modified, If-Modified-Since, ETag, etc).
>
> For testing with the browser, there's a plugin for Firefox called Firebug.
> Maybe there's something similar for Chrome, I don't know. Firebug displays
> the http communication between browser and server, including the http
> headers.
>
> If you don't find such a plugin, you could sniff the network traffic
> directly via a tool such as wireshark (works on Windows too and it's free).
>
> You can look if the "Cache-Control" header is always set by your server.
> If it is set then the browser is not supposed to cache the page linked from
> the hyperlink, so it should replay the request every time you click on it.
>
> If it is not set and you cannot force apache to set it by the Header
> directive, then force it directly in your module
> (apr_table_set(r->headers_out, "Cache-Control", "must-revalidate,
> no-cache"); apr_table_set(r->err_headers_**out, "Cache-Control",
> "must-revalidate, no-cache");)
>
> Sorin
>
>
>
>
>>
>> On Thu, Jun 27, 2013 at 2:25 AM, Sorin Manolache <sorinm@gmail.com>
>> wrote:
>>
>>  On 2013-06-26 22:22, Sindhi Sindhi wrote:
>>>
>>>  Hi,
>>>>
>>>> I have a C++ Apache filter module for HTML output filtering. I'm seeing
>>>> a
>>>> certain behavior when using my filter module after setting cookies and
>>>> would want to know if thats expected.
>>>>
>>>> I have a html page index.html, this page has a hyperlink called "Click
>>>> here" and when I click on this link, a second page index2.html should be
>>>> launched.
>>>>
>>>> My filter applies some business logic while filtering html files.
>>>>
>>>> I have a cookie.html file that has Javascript to set a cookie (using
>>>> document.cookie) in the browser.
>>>>
>>>> I need to do the following:
>>>> 1. Enable my filter using LoadModule directive and start the server
>>>> 2. Set a cookie with name=cookieName, value=cookieValue in the browser
>>>> using the cookie.html
>>>> 3. Launch index.html, and then click on "Click here". When this call
>>>> goes
>>>> to the filter module, I have to apply some business logic before
>>>> index2.html is rendered on browser.
>>>>
>>>> But when I set the cookie in step2 above, I see that the filter module
>>>> is
>>>> not called because a server call is not made, and the browser opens the
>>>> cached index2.html which does not have my business logic applied.
>>>>
>>>> And, if I dont set the cookie mentioned in step2 above, a server call is
>>>> made when I click on "Click here" link.
>>>>
>>>> How can I ensure that, when I try to launch a html page from a
>>>> hyperlink,
>>>> the call goes to the filter module even when I set a browser cookie.
>>>>
>>>>
>>> What happens if you clear your browser's memory and disk cache before you
>>> click on the hyperlink?
>>>
>>> If it's a cache issue, then use the mod_headers module and the 'Header
>>> set
>>> Cache-Control "must-revalidate, no-cache"' directive to disable browser
>>> caching.
>>>
>>> Sorin
>>>
>>>
>>>
>>>
>>>
>>>  My apologies if I'm asking something fundamental, I'm new to how cookies
>>>> work with web-servers, any help would be really appreciated.
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message