Erlang Mailing Lists

Author Message

<  Erlyweb mailing list  ~  cache_control

Guest
Posted: Thu Aug 16, 2007 11:02 am Reply with quote
Guest
I am trying to set the cache_control header for requests of static
content, e.g. javascripts and images. In the hook/1 function I use
yaws_arg:appmoddata/1 to identify these requests. No problem so far.

However, I am not able to set the header correctly. In hook/1 I have
tried things like

{response, [{header, {cache_control, "max-age=3600"}}, {body, {ewc,
A}}]}

but it always result in errors like

<h2>Internal error, yaws code crashed</h2><br /><hr />
<pre>yaws code at appmod:0 crashed or ret bad val:{response,
[{header,
{cache_control,
"max-age=3600"}},
{body,
{ewc,
{arg,
...
...
...

Any ideas what's wrong?

Thanks in advance,
Fredrik

PS.
I use the trunk at revision 163, by the way.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Thu Aug 16, 2007 6:15 pm Reply with quote
Guest
Try returning this from hook/1:

{phased, {ewc, A},
fun(_Ewc, Data) ->
[{header, {cache_control, "max-age=3600"}},
{html, Data}]
end}

if it doesn't work, try


{phased, {ewc, A},
fun(_Ewc, Data) ->
{response, [{header, {cache_control, "max-age=3600"}},
{html, Data}]}
end}

let me know if it works.

Yariv

On 8/16/07, fredrik <fredrik.sjunnesson@acobiaflux.se> wrote:
>
> I am trying to set the cache_control header for requests of static
> content, e.g. javascripts and images. In the hook/1 function I use
> yaws_arg:appmoddata/1 to identify these requests. No problem so far.
>
> However, I am not able to set the header correctly. In hook/1 I have
> tried things like
>
> {response, [{header, {cache_control, "max-age=3600"}}, {body, {ewc,
> A}}]}
>
> but it always result in errors like
>
> <h2>Internal error, yaws code crashed</h2><br /><hr />
> <pre>yaws code at appmod:0 crashed or ret bad val:{response,
> [{header,
> {cache_control,
> "max-age=3600"}},
> {body,
> {ewc,
> {arg,
> ...
> ...
> ...
>
> Any ideas what's wrong?
>
> Thanks in advance,
> Fredrik
>
> PS.
> I use the trunk at revision 163, by the way.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Thu Aug 16, 2007 9:14 pm Reply with quote
Guest
Thanks for the quick response! Unfortunately neither of the suggestions seem to work.

The first one gives this error message:

ERROR erlang code crashed:
File: appmod:0
Reason: {invalid_response,[{header,{cache_control,"max-age=3600"}}],
"Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}


and the second one gives this:

ERROR erlang code crashed:
File: appmod:0
Reason: {invalid_response,
[{response,
[{header,{cache_control,"max-age=3600"}},
{html,
[<<"User Configurations \n">>,
[],
<<"\n">>,
...
...
...
<<"\n\n\n">>]],
<<"\n\n\n">>]}]}],
"Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}


In addition, when requesting resources that are not rendered by erlyweb, i.e. static web pages, stylesheets, images and javascripts, the "second phase" of the phased statement isn't called at all. So for these resources, which are the ones that actually are static, the cache_control header isn't applied at all.

/Fredrik

-----Original Message-----
From: erlyweb@googlegroups.com on behalf of Yariv Sadan
Sent: Thu 8/16/2007 8:15 PM
To: erlyweb@googlegroups.com
Subject: [erlyweb-list] Re: cache_control


Try returning this from hook/1:

{phased, {ewc, A},
fun(_Ewc, Data) ->
[{header, {cache_control, "max-age=3600"}},
{html, Data}]
end}

if it doesn't work, try


{phased, {ewc, A},
fun(_Ewc, Data) ->
{response, [{header, {cache_control, "max-age=3600"}},
{html, Data}]}
end}

let me know if it works.

Yariv

On 8/16/07, fredrik <fredrik.sjunnesson@acobiaflux.se> wrote:
>
> I am trying to set the cache_control header for requests of static
> content, e.g. javascripts and images. In the hook/1 function I use
> yaws_arg:appmoddata/1 to identify these requests. No problem so far.
>
> However, I am not able to set the header correctly. In hook/1 I have
> tried things like
>
> {response, [{header, {cache_control, "max-age=3600"}}, {body, {ewc,
> A}}]}
>
> but it always result in errors like
>
> <h2>Internal error, yaws code crashed</h2><br /><hr />
> <pre>yaws code at appmod:0 crashed or ret bad val:{response,
> [{header,
> {cache_control,
> "max-age=3600"}},
> {body,
> {ewc,
> {arg,
> ...
> ...
> ...
>
> Any ideas what's wrong?
>
> Thanks in advance,
> Fredrik
>
> PS.
> I use the trunk at revision 163, by the way.
>
>
> >
>




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---



Post recived from mailinglist
Guest
Posted: Fri Aug 17, 2007 5:54 am Reply with quote
Guest
Ok, this was a bug. I fixed it in trunk. You can now use {response,
Elems} in hook/1, just like regular controller functions. Examples:

hook(A) ->
{response, [{header, "foo: bar"}, {body, {ewc, A}}]}.

hook(A) ->
{phased,
{response, [{header, "foo: bar"}, {body, {ewc, A}}]},
fun(_Ewc, Data) ->
{ewc, html_container, [A, Data]}
end}.

Let me know if you run into any problems.

Thanks,
Yariv


On 8/16/07, Fredrik Sjunnesson <Fredrik.Sjunnesson@acobiaflux.se> wrote:
> Thanks for the quick response! Unfortunately neither of the suggestions seem to work.
>
> The first one gives this error message:
>
> ERROR erlang code crashed:
> File: appmod:0
> Reason: {invalid_response,[{header,{cache_control,"max-age=3600"}}],
> "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
>
>
> and the second one gives this:
>
> ERROR erlang code crashed:
> File: appmod:0
> Reason: {invalid_response,
> [{response,
> [{header,{cache_control,"max-age=3600"}},
> {html,
> [<<"User Configurations \n">>,
> [],
> <<"\n">>,
> ...
> ...
> ...
> <<"\n\n\n">>]],
> <<"\n\n\n">>]}]}],
> "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
>
>
> In addition, when requesting resources that are not rendered by erlyweb, i.e. static web pages, stylesheets, images and javascripts, the "second phase" of the phased statement isn't called at all. So for these resources, which are the ones that actually are static, the cache_control header isn't applied at all.
>
> /Fredrik
>
> -----Original Message-----
> From: erlyweb@googlegroups.com on behalf of Yariv Sadan
> Sent: Thu 8/16/2007 8:15 PM
> To: erlyweb@googlegroups.com
> Subject: [erlyweb-list] Re: cache_control
>
>
> Try returning this from hook/1:
>
> {phased, {ewc, A},
> fun(_Ewc, Data) ->
> [{header, {cache_control, "max-age=3600"}},
> {html, Data}]
> end}
>
> if it doesn't work, try
>
>
> {phased, {ewc, A},
> fun(_Ewc, Data) ->
> {response, [{header, {cache_control, "max-age=3600"}},
> {html, Data}]}
> end}
>
> let me know if it works.
>
> Yariv
>
> On 8/16/07, fredrik <fredrik.sjunnesson@acobiaflux.se> wrote:
> >
> > I am trying to set the cache_control header for requests of static
> > content, e.g. javascripts and images. In the hook/1 function I use
> > yaws_arg:appmoddata/1 to identify these requests. No problem so far.
> >
> > However, I am not able to set the header correctly. In hook/1 I have
> > tried things like
> >
> > {response, [{header, {cache_control, "max-age=3600"}}, {body, {ewc,
> > A}}]}
> >
> > but it always result in errors like
> >
> > <h2>Internal error, yaws code crashed</h2><br /><hr />
> > <pre>yaws code at appmod:0 crashed or ret bad val:{response,
> > [{header,
> > {cache_control,
> > "max-age=3600"}},
> > {body,
> > {ewc,
> > {arg,
> > ...
> > ...
> > ...
> >
> > Any ideas what's wrong?
> >
> > Thanks in advance,
> > Fredrik
> >
> > PS.
> > I use the trunk at revision 163, by the way.
> >
> >
> > >
> >
>
>
>
>
> >
>
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Fri Aug 17, 2007 9:18 am Reply with quote
Guest
Thanks, that took me a step forward. I am still not able to set the
header but this time I don't think Erlyweb is the one to blame
anymore.

The output from erlyweb:out/1, i.e. the function that is called by
yaws, returns

[{header, {cache_control, "max-age=3600"}}, {page, "/images/
footer.jpg"}]

etc and as far as I can tell this is correct. Yaws internal function
accumulate_header({cache_control, What}) is even called but it doesn't
result in any effect on the final header anyway. The behavior is the
same no matter what header I try to set.

It definitely seems like a problem in yaws, or maybe more like a
problem with my configuration of yaws. I'll do some testing with pure
yaws to see if I can figure it out.

/Fredrik


On Aug 17, 7:53 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> Ok, this was a bug. I fixed it in trunk. You can now use {response,
> Elems} in hook/1, just like regular controller functions. Examples:
>
> hook(A) ->
> {response, [{header, "foo: bar"}, {body, {ewc, A}}]}.
>
> hook(A) ->
> {phased,
> {response, [{header, "foo: bar"}, {body, {ewc, A}}]},
> fun(_Ewc, Data) ->
> {ewc, html_container, [A, Data]}
> end}.
>
> Let me know if you run into any problems.
>
> Thanks,
> Yariv
>
> On 8/16/07, Fredrik Sjunnesson <Fredrik.Sjunnes...@acobiaflux.se> wrote:
>
> > Thanks for the quick response! Unfortunately neither of the suggestions seem to work.
>
> > The first one gives this error message:
>
> > ERROR erlang code crashed:
> > File: appmod:0
> > Reason: {invalid_response,[{header,{cache_control,"max-age=3600"}}],
> > "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
>
> > and the second one gives this:
>
> > ERROR erlang code crashed:
> > File: appmod:0
> > Reason: {invalid_response,
> > [{response,
> > [{header,{cache_control,"max-age=3600"}},
> > {html,
> > [<<"User Configurations \n">>,
> > [],
> > <<"\n">>,
> > ...
> > ...
> > ...
> > <<"\n\n\n">>]],
> > <<"\n\n\n">>]}]}],
> > "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
>
> > In addition, when requesting resources that are not rendered by erlyweb, i.e. static web pages, stylesheets, images and javascripts, the "second phase" of the phased statement isn't called at all. So for these resources, which are the ones that actually are static, the cache_control header isn't applied at all.
>
> > /Fredrik
>
> > -----Original Message-----
> > From: erlyweb@googlegroups.com on behalf of Yariv Sadan
> > Sent: Thu 8/16/2007 8:15 PM
> > To: erlyweb@googlegroups.com
> > Subject: [erlyweb-list] Re: cache_control
>
> > Try returning this from hook/1:
>
> > {phased, {ewc, A},
> > fun(_Ewc, Data) ->
> > [{header, {cache_control, "max-age=3600"}},
> > {html, Data}]
> > end}
>
> > if it doesn't work, try
>
> > {phased, {ewc, A},
> > fun(_Ewc, Data) ->
> > {response, [{header, {cache_control, "max-age=3600"}},
> > {html, Data}]}
> > end}
>
> > let me know if it works.
>
> > Yariv
>
> > On 8/16/07, fredrik <fredrik.sjunnes...@acobiaflux.se> wrote:
>
> > > I am trying to set the cache_control header for requests of static
> > > content, e.g. javascripts and images. In the hook/1 function I use
> > > yaws_arg:appmoddata/1 to identify these requests. No problem so far.
>
> > > However, I am not able to set the header correctly. In hook/1 I have
> > > tried things like
>
> > > {response, [{header, {cache_control, "max-age=3600"}}, {body, {ewc,
> > > A}}]}
>
> > > but it always result in errors like
>
> > > <h2>Internal error, yaws code crashed</h2><br /><hr />
> > > <pre>yaws code at appmod:0 crashed or ret bad val:{response,
> > > [{header,
> > > {cache_control,
> > > "max-age=3600"}},
> > > {body,
> > > {ewc,
> > > {arg,
> > > ...
> > > ...
> > > ...
>
> > > Any ideas what's wrong?
>
> > > Thanks in advance,
> > > Fredrik
>
> > > PS.
> > > I use the trunk at revision 163, by the way.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Fri Aug 17, 2007 5:14 pm Reply with quote
Guest
This may help you (from the yaws docs):

{page, {Options, Page}}

Like the above, but supplying an additional deep list of options. For
now, the only type of option is {header, H} with the effect of
accumulating the HTTP header H for page Page.





On 8/17/07, fredrik <fredrik.sjunnesson@acobiaflux.se> wrote:
>
> Thanks, that took me a step forward. I am still not able to set the
> header but this time I don't think Erlyweb is the one to blame
> anymore.
>
> The output from erlyweb:out/1, i.e. the function that is called by
> yaws, returns
>
> [{header, {cache_control, "max-age=3600"}}, {page, "/images/
> footer.jpg"}]
>
> etc and as far as I can tell this is correct. Yaws internal function
> accumulate_header({cache_control, What}) is even called but it doesn't
> result in any effect on the final header anyway. The behavior is the
> same no matter what header I try to set.
>
> It definitely seems like a problem in yaws, or maybe more like a
> problem with my configuration of yaws. I'll do some testing with pure
> yaws to see if I can figure it out.
>
> /Fredrik
>
>
> On Aug 17, 7:53 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> > Ok, this was a bug. I fixed it in trunk. You can now use {response,
> > Elems} in hook/1, just like regular controller functions. Examples:
> >
> > hook(A) ->
> > {response, [{header, "foo: bar"}, {body, {ewc, A}}]}.
> >
> > hook(A) ->
> > {phased,
> > {response, [{header, "foo: bar"}, {body, {ewc, A}}]},
> > fun(_Ewc, Data) ->
> > {ewc, html_container, [A, Data]}
> > end}.
> >
> > Let me know if you run into any problems.
> >
> > Thanks,
> > Yariv
> >
> > On 8/16/07, Fredrik Sjunnesson <Fredrik.Sjunnes...@acobiaflux.se> wrote:
> >
> > > Thanks for the quick response! Unfortunately neither of the suggestions seem to work.
> >
> > > The first one gives this error message:
> >
> > > ERROR erlang code crashed:
> > > File: appmod:0
> > > Reason: {invalid_response,[{header,{cache_control,"max-age=3600"}}],
> > > "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
> >
> > > and the second one gives this:
> >
> > > ERROR erlang code crashed:
> > > File: appmod:0
> > > Reason: {invalid_response,
> > > [{response,
> > > [{header,{cache_control,"max-age=3600"}},
> > > {html,
> > > [<<"User Configurations \n">>,
> > > [],
> > > <<"\n">>,
> > > ...
> > > ...
> > > ...
> > > <<"\n\n\n">>]],
> > > <<"\n\n\n">>]}]}],
> > > "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
> >
> > > In addition, when requesting resources that are not rendered by erlyweb, i.e. static web pages, stylesheets, images and javascripts, the "second phase" of the phased statement isn't called at all. So for these resources, which are the ones that actually are static, the cache_control header isn't applied at all.
> >
> > > /Fredrik
> >
> > > -----Original Message-----
> > > From: erlyweb@googlegroups.com on behalf of Yariv Sadan
> > > Sent: Thu 8/16/2007 8:15 PM
> > > To: erlyweb@googlegroups.com
> > > Subject: [erlyweb-list] Re: cache_control
> >
> > > Try returning this from hook/1:
> >
> > > {phased, {ewc, A},
> > > fun(_Ewc, Data) ->
> > > [{header, {cache_control, "max-age=3600"}},
> > > {html, Data}]
> > > end}
> >
> > > if it doesn't work, try
> >
> > > {phased, {ewc, A},
> > > fun(_Ewc, Data) ->
> > > {response, [{header, {cache_control, "max-age=3600"}},
> > > {html, Data}]}
> > > end}
> >
> > > let me know if it works.
> >
> > > Yariv
> >
> > > On 8/16/07, fredrik <fredrik.sjunnes...@acobiaflux.se> wrote:
> >
> > > > I am trying to set the cache_control header for requests of static
> > > > content, e.g. javascripts and images. In the hook/1 function I use
> > > > yaws_arg:appmoddata/1 to identify these requests. No problem so far.
> >
> > > > However, I am not able to set the header correctly. In hook/1 I have
> > > > tried things like
> >
> > > > {response, [{header, {cache_control, "max-age=3600"}}, {body, {ewc,
> > > > A}}]}
> >
> > > > but it always result in errors like
> >
> > > > <h2>Internal error, yaws code crashed</h2><br /><hr />
> > > > <pre>yaws code at appmod:0 crashed or ret bad val:{response,
> > > > [{header,
> > > > {cache_control,
> > > > "max-age=3600"}},
> > > > {body,
> > > > {ewc,
> > > > {arg,
> > > > ...
> > > > ...
> > > > ...
> >
> > > > Any ideas what's wrong?
> >
> > > > Thanks in advance,
> > > > Fredrik
> >
> > > > PS.
> > > > I use the trunk at revision 163, by the way.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist
Guest
Posted: Fri Aug 17, 2007 10:33 pm Reply with quote
Guest
That was the way to do it! Thanks a lot!

So, if the appmoddata starts with "images/", "stylesheets/" or
"javascripts/" I do the following

{response, [{page, {[{header, {cache_control, "max-age=360000"}}],
yaws_arg:appmoddata(A)}}]}

in hook/1. That way all static contents is cached by the browser and
to load a page now results in ONE request to the server instead of
almost 20, which used to be the case.

Thanks again,
/Fredrik

On Aug 17, 7:14 pm, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> This may help you (from the yaws docs):
>
> {page, {Options, Page}}
>
> Like the above, but supplying an additional deep list of options. For
> now, the only type of option is {header, H} with the effect of
> accumulating the HTTP header H for page Page.
>
> On 8/17/07, fredrik <fredrik.sjunnes...@acobiaflux.se> wrote:
>
>
>
> > Thanks, that took me a step forward. I am still not able to set the
> > header but this time I don't think Erlyweb is the one to blame
> > anymore.
>
> > The output from erlyweb:out/1, i.e. the function that is called by
> > yaws, returns
>
> > [{header, {cache_control, "max-age=3600"}}, {page, "/images/
> > footer.jpg"}]
>
> > etc and as far as I can tell this is correct. Yaws internal function
> > accumulate_header({cache_control, What}) is even called but it doesn't
> > result in any effect on the final header anyway. The behavior is the
> > same no matter what header I try to set.
>
> > It definitely seems like a problem in yaws, or maybe more like a
> > problem with my configuration of yaws. I'll do some testing with pure
> > yaws to see if I can figure it out.
>
> > /Fredrik
>
> > On Aug 17, 7:53 am, "Yariv Sadan" <yarivsa...@gmail.com> wrote:
> > > Ok, this was a bug. I fixed it in trunk. You can now use {response,
> > > Elems} in hook/1, just like regular controller functions. Examples:
>
> > > hook(A) ->
> > > {response, [{header, "foo: bar"}, {body, {ewc, A}}]}.
>
> > > hook(A) ->
> > > {phased,
> > > {response, [{header, "foo: bar"}, {body, {ewc, A}}]},
> > > fun(_Ewc, Data) ->
> > > {ewc, html_container, [A, Data]}
> > > end}.
>
> > > Let me know if you run into any problems.
>
> > > Thanks,
> > > Yariv
>
> > > On 8/16/07, Fredrik Sjunnesson <Fredrik.Sjunnes...@acobiaflux.se> wrote:
>
> > > > Thanks for the quick response! Unfortunately neither of the suggestions seem to work.
>
> > > > The first one gives this error message:
>
> > > > ERROR erlang code crashed:
> > > > File: appmod:0
> > > > Reason: {invalid_response,[{header,{cache_control,"max-age=3600"}}],
> > > > "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
>
> > > > and the second one gives this:
>
> > > > ERROR erlang code crashed:
> > > > File: appmod:0
> > > > Reason: {invalid_response,
> > > > [{response,
> > > > [{header,{cache_control,"max-age=3600"}},
> > > > {html,
> > > > [<<"User Configurations \n">>,
> > > > [],
> > > > <<"\n">>,
> > > > ...
> > > > ...
> > > > ...
> > > > <<"\n\n\n">>]],
> > > > <<"\n\n\n">>]}]}],
> > > > "Response values other than 'data' and 'ewc' tuples must be enclosed a 'response' tuple. In addition, subcomponents may only return 'data' and/or 'ewc' tuples."}
>
> > > > In addition, when requesting resources that are not rendered by erlyweb, i.e. static web pages, stylesheets, images and javascripts, the "second phase" of the phased statement isn't called at all. So for these resources, which are the ones that actually are static, the cache_control header isn't applied at all.
>
> > > > /Fredrik
>
> > > > -----Original Message-----
> > > > From: erlyweb@googlegroups.com on behalf of Yariv Sadan
> > > > Sent: Thu 8/16/2007 8:15 PM
> > > > To: erlyweb@googlegroups.com
> > > > Subject: [erlyweb-list] Re: cache_control
>
> > > > Try returning this from hook/1:
>
> > > > {phased, {ewc, A},
> > > > fun(_Ewc, Data) ->
> > > > [{header, {cache_control, "max-age=3600"}},
> > > > {html, Data}]
> > > > end}
>
> > > > if it doesn't work, try
>
> > > > {phased, {ewc, A},
> > > > fun(_Ewc, Data) ->
> > > > {response, [{header, {cache_control, "max-age=3600"}},
> > > > {html, Data}]}
> > > > end}
>
> > > > let me know if it works.
>
> > > > Yariv
>
> > > > On 8/16/07, fredrik <fredrik.sjunnes...@acobiaflux.se> wrote:
>
> > > > > I am trying to set the cache_control header for requests of static
> > > > > content, e.g. javascripts and images. In the hook/1 function I use
> > > > > yaws_arg:appmoddata/1 to identify these requests. No problem so far.
>
> > > > > However, I am not able to set the header correctly. In hook/1 I have
> > > > > tried things like
>
> > > > > {response, [{header, {cache_control, "max-age=3600"}}, {body, {ewc,
> > > > > A}}]}
>
> > > > > but it always result in errors like
>
> > > > > <h2>Internal error, yaws code crashed</h2><br /><hr />
> > > > > <pre>yaws code at appmod:0 crashed or ret bad val:{response,
> > > > > [{header,
> > > > > {cache_control,
> > > > > "max-age=3600"}},
> > > > > {body,
> > > > > {ewc,
> > > > > {arg,
> > > > > ...
> > > > > ...
> > > > > ...
>
> > > > > Any ideas what's wrong?
>
> > > > > Thanks in advance,
> > > > > Fredrik
>
> > > > > PS.
> > > > > I use the trunk at revision 163, by the way.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "erlyweb" group.
To post to this group, send email to erlyweb@googlegroups.com
To unsubscribe from this group, send email to erlyweb-unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/erlyweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum