Set outgoing header?

18 views
Skip to first unread message

Jeremy Raymond

unread,
May 2, 2010, 10:08:03 PM5/2/10
to Nitrogen Web Framework for Erlang
Hi,

I have a web app running in an iFrame (Nitrogen 1.x). IE is silently
dropping cookies because it seems them as 3rd party. Several sites
mention that setting a P3P compact header to outgoing response headers
may work around this issue. Specifically:

P3P:CP = "IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND
CNT"'

How can I set this on all outgoing response headers?

--
Jeremy Raymond

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

Jeremy Raymond

unread,
May 2, 2010, 10:22:57 PM5/2/10
to Nitrogen Web Framework for Erlang
Using wf_platform:set_header/2 did the trick. I updated
wf_platform:build_response/0 to set this for every response. Any
better place to put this?

B. Nicholson

unread,
May 2, 2010, 10:23:01 PM5/2/10
to Nitrogen Web Framework for Erlang
I think the following will do that (from the Nitrogen 2
documentation).

wf:header(StringKey, HeaderValue) -> ok

Sets an HTTP header during the next response.

Nitrogen 1 probably has the same function.

Barry Nicholson

Jeremy Raymond

unread,
May 3, 2010, 8:40:35 AM5/3/10
to nitro...@googlegroups.com
wf_platform:set_header/2 seems to be the 1.x equivalent. I need to set this header on every response from my app otherwise the wf cookie and an others I set get dropped in IE iFrames. What is a good way to implement setting this header on every response (besides hacking it into wf_platform:build_response/0)?

Should Nitrogen be updated to set this by default? If not any Nitrogen app running in an iFrame in IE would function as expected as the wf cookie dropped.

--
Jeremy Raymond

Rusty Klophaus

unread,
May 3, 2010, 8:50:22 AM5/3/10
to nitro...@googlegroups.com
Hi Jeremy,

Nitrogen 1.x uses a callback module for things like this... check out quickstart.erl in the quickstart project, specifically the request/1 function.

Best,
Rusty

Jeremy Raymond

unread,
May 3, 2010, 9:23:31 AM5/3/10
to nitro...@googlegroups.com
Thanks Rusty. It didn't occur to me to put it there. So if I do a wf_platform:set_header/2 from in the request/1 callback function it will pass that along in the response to the client browser?

--
Jeremy Raymond

Silvester

unread,
May 16, 2010, 6:12:39 PM5/16/10
to Nitrogen Web Framework for Erlang
hi guys,

so what is the equivalent to request/1 in Nitrogen 2.x?
where should I insert wf:header/2 with my data?

/Abe


On May 3, 4:23 pm, Jeremy Raymond <jeraym...@gmail.com> wrote:
> Thanks Rusty. It didn't occur to me to put it there. So if I do a
> wf_platform:set_header/2 from in the request/1 callback function it will
> pass that along in the response to the client browser?
>
> --
> Jeremy Raymond
>
>
>
>
>
> On Mon, May 3, 2010 at 8:50 AM, Rusty Klophaus <rkloph...@gmail.com> wrote:
> > Hi Jeremy,
>
> > Nitrogen 1.x uses a callback module for things like this... check out
> > quickstart.erl in the quickstart project, specifically the request/1
> > function.
>
> > Best,
> > Rusty
>
> > On Mon, May 3, 2010 at 8:40 AM, Jeremy Raymond <jeraym...@gmail.com>wrote:
>
> >> wf_platform:set_header/2 seems to be the 1.x equivalent. I need to set
> >> this header on every response from my app otherwise the wf cookie and an
> >> others I set get dropped in IE iFrames. What is a good way to implement
> >> setting this header on every response (besides hacking it into
> >> wf_platform:build_response/0)?
>
> >> Should Nitrogen be updated to set this by default? If not any Nitrogen app
> >> running in an iFrame in IE would function as expected as the wf cookie
> >> dropped.
>
> >> --
> >> Jeremy Raymond
>
> >> On Sun, May 2, 2010 at 10:23 PM, B. Nicholson <bnicho...@gmail.com>wrote:
>
> >>> I think the following will do that (from the Nitrogen 2
> >>> documentation).
>
> >>> wf:header(StringKey, HeaderValue) -> ok
>
> >>> Sets an HTTP header during the next response.
>
> >>> Nitrogen 1 probably has the same function.
>
> >>> Barry Nicholson
>
> >>> On May 2, 9:08 pm, Jeremy Raymond <jeraym...@gmail.com> wrote:
> >>> > Hi,
>
> >>> > I have a web app running in an iFrame (Nitrogen 1.x). IE is silently
> >>> > dropping cookies because it seems them as 3rd party. Several sites
> >>> > mention that setting a P3P compact header to outgoing response headers
> >>> > may work around this issue. Specifically:
>
> >>> > P3P:CP = "IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND
> >>> > CNT"'
>
> >>> > How can I set this on all outgoing response headers?
>
> >>> > --
> >>> > Jeremy Raymond
>
> >>> > --
> >>> > You received this message because you are subscribed to the Google
> >>> Groups "Nitrogen Web Framework for Erlang" group.
> >>> > To post to this group, send email to nitro...@googlegroups.com.
> >>> > To unsubscribe from this group, send email to
> >>> nitrogenweb...@googlegroups.com<nitrogenweb%2Bunsubscribe@googlegr oups.com>
> >>> .
> >>> > For more options, visit this group athttp://
> >>> groups.google.com/group/nitrogenweb?hl=en.
>
> >>> --
> >>> You received this message because you are subscribed to the Google Groups
> >>> "Nitrogen Web Framework for Erlang" group.
> >>> To post to this group, send email to nitro...@googlegroups.com.
> >>> To unsubscribe from this group, send email to
> >>> nitrogenweb...@googlegroups.com<nitrogenweb%2Bunsubscribe@googlegr oups.com>
> >>> .
> >>> For more options, visit this group at
> >>>http://groups.google.com/group/nitrogenweb?hl=en.
>
> >>  --
> >> You received this message because you are subscribed to the Google Groups
> >> "Nitrogen Web Framework for Erlang" group.
> >> To post to this group, send email to nitro...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> nitrogenweb...@googlegroups.com<nitrogenweb%2Bunsubscribe@googlegr oups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/nitrogenweb?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "Nitrogen Web Framework for Erlang" group.
> > To post to this group, send email to nitro...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nitrogenweb...@googlegroups.com<nitrogenweb%2Bunsubscribe@googlegr oups.com>
> > .
Reply all
Reply to author
Forward
0 new messages