Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  problem with custom http headers

rsaccon
Posted: Tue Jan 30, 2007 7:15 am Reply with quote
User Joined: 09 Aug 2006 Posts: 144
the api docu says that custom headers can be added to the yaws return values like this:

View user's profile Send private message
Guest
Posted: Tue Jan 30, 2007 8:46 am Reply with quote
Guest
Roberto Saccon wrote:
> the api docu says that custom headers can be added to the yaws return
> values like this:
>
> {header, "My-X-Header: gadong"}
>
> But when I form the return value like this:
>
> {redirect_local, {any_path, "/"}}, {header, "My-X-Header: gadong"}
>
> and print out at the next request (with rel. URL: "/") the yaws headers
> record, there is no "My-X-Header: gadong" there.
>


Works fine for me, both your code above and also slightly better:


# cat /tmp/a.yaws

<erl>

out(A) ->
[{redirect_local, {any_path, "/"}},
{header, {"My-X-Header", "gadong"}}].

</erl>


And then:


# curl -k -I https://buzz:4443/a.yaws
HTTP/1.1 302 Found
Server: Yaws/1.66 Yet Another Web Server
Location: https://buzz:4443/
Date: Tue, 30 Jan 2007 08:48:01 GMT
Content-Type: text/html
My-X-Header: gadong


/klacke

--
Claes Wikstrom -- Caps lock is nowhere and
http://www.tail-f.com -- everything is under control
cellphone: +46 70 2097763

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
noss
Posted: Tue Jan 30, 2007 8:51 am Reply with quote
User Joined: 09 Oct 2005 Posts: 290
I think you are expecting to see the header in the response headers of
the page you redirected to, but it only shows in the redirecting
response.

On 1/30/07, Roberto Saccon <rsaccon@gmail.com> wrote:
> the api docu says that custom headers can be added to the yaws return values
> like this:
>
> {header, "My-X-Header: gadong"}
>
> But when I form the return value like this:
>
> {redirect_local, {any_path, "/"}}, {header, "My-X-Header: gadong"}
>
> and print out at the next request (with rel. URL: "/") the yaws headers
> record, there is no "My-X-Header: gadong" there.
>
>
> Is there anything I am doing wrong ?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message
rsaccon
Posted: Tue Jan 30, 2007 9:08 am Reply with quote
User Joined: 09 Aug 2006 Posts: 144
Christian, yes this is what I was expecting ...

Now the question is, how can I put some kind of state information into a local redirect ? The path is not an option, because it has to be "/" ? Just cookies or is there any other way ?

--
Roberto Saccon
Post recived from mailinglist
View user's profile Send private message
noss
Posted: Tue Jan 30, 2007 9:23 am Reply with quote
User Joined: 09 Oct 2005 Posts: 290
You cant add some args to the path so the next request?

Do you want headers because this is a reply to ajax xhr requests?


On 1/30/07, Roberto Saccon <rsaccon@gmail.com> wrote:
> Now the question is, how can I put some kind of state information into a
> local redirect ? The path is not an option, because it has to be "/" ? Just
> cookies or is there any other way ?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message
rsaccon
Posted: Tue Jan 30, 2007 9:41 am Reply with quote
User Joined: 09 Aug 2006 Posts: 144
On 1/30/07, Christian S <chsu79@gmail.com (chsu79@gmail.com)> wrote:
Quote:
You cant add some args to the path so the next request?

No, see below


Quote:
Do you want headers because this is a reply to ajax xhr requests?

Yes, and to be more precise it's for the transition from normal URL to
View user's profile Send private message
noss
Posted: Tue Jan 30, 2007 10:02 am Reply with quote
User Joined: 09 Oct 2005 Posts: 290
On 1/30/07, Roberto Saccon <rsaccon@gmail.com> wrote:
> On 1/30/07, Christian S <chsu79@gmail.com> wrote:
> > You cant add some args to the path so the next request?
>
> No, see below
>
> > Do you want headers because this is a reply to ajax xhr requests?
>
> Yes, and to be more precise it's for the transition from normal URL to
> ajaxified URLs
>
> Original URL: http://foo.com/args
>
> redirected URL: http://foo.com/#/args (the '#/args' I add via Javascript
> after pageload)

Cant you do this client side instead? Have javascript that replace the
current page with the ajaxified page?

You are trying to build bookmarkable state for ajaxified pages, right?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message

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 can attach files in this forum
You can download files in this forum