I am trying to use express + connect + passport + http-proxy, and I believe 
I am encountering the problem that Jose wrote about: "Do not use bodyparser 
middleware since it will read all the stream and you will not be able to 
fully pipe the requests. "

Is there a way to cache the original request before it goes through all of 
the middleware, so that I can proxy it correctly? Alternatively, I can run 
the http-proxy on a different server without middleware, but it needs to be 
able to query the express / passport server with a connect.sid cookie to 
find out if that session is authenticated and what the user information is. 

Is that possible? Am I overlooking things? Are there other good solutions?

On Friday, February 15, 2013 2:26:58 PM UTC-5, José F. Romaniello wrote:
>
> Sorry @greelgorke but I am not totally convinced but your advice to 
> @jalalm, this is what connect is meant to do and there already a lot of 
> middlewares implemented for this. In addition to implementing a session 
> strategy on top of the http you will have also to handle cookies.
>
> All these things are very small per-se but also connect is small and it is 
> already done.
>
> On the other hand every example you have shown from the documentation of 
> Passport.js refers to its usage as a connect middleware. So, if you want to 
> use in the http request handler, you have to do some tricks for the "next" 
> argument.
>
> With all this peaces of information I dont understand the argument about 
> not using connect.
>
>
> So, I am still sold to my first advice; use connect+passport+session (with 
> some store like redis).. When you have this problem solved, you can pipe 
> requests to other server either using mikeal/request pipe functionality as 
> shown here:
>
> https://github.com/mikeal/request#streaming
>
> Or using the http-proxy in the same instance of http server.
>
>
>
> 2013/2/15 greelgorke <[email protected] <javascript:>>
>
>> passport handles sessions by default, so you have to disable them if you 
>> dont want sessions. see here http://passportjs.org/guide/configure/ how 
>> to handle sessions. you could throw in a memory db like memcached or redis, 
>> or just hold it in memory by yourself. for distributed proxy i'd suggest 
>> redis or even a rdbms.
>>
>> Am Freitag, 15. Februar 2013 17:07:53 UTC+1 schrieb José F. Romaniello:
>>>
>>> @greelgorke and what do you suggest for session management as @jalalm 
>>> suggest he wants to authenticate the user in one route and then have the 
>>> information available in other routes?
>>>  
>>>
>>> 2013/2/15 greelgorke <[email protected]>
>>>
>>>> in your gist: you dopn't need express here. look at examples here: 
>>>> http://passportjs.org/guide/authenticate/ you can just use 
>>>> passport.authenticate in your request handler after checking the methods
>>>>
>>>> Am Freitag, 15. Februar 2013 15:45:48 UTC+1 schrieb [email protected]
>>>> :
>>>>
>>>>> Thanks,
>>>>>
>>>>> This is the gist link to the simple proxy server code that i wrote 
>>>>> using express and node-http-proxy
>>>>>
>>>>> https://gist.github.com/jalaluddeen/4960691
>>>>>
>>>>> what i wanna do is add authentication and session management to this 
>>>>> so that only requests from authenticated users are passed to apache or 
>>>>> elasticsearch.
>>>>>
>>>>>
>>>>> On Friday, February 15, 2013 2:17:19 PM UTC+5:30, greelgorke wrote:
>>>>>>
>>>>>> yes, passportjs is a good choice. the examples on passportjs.org use 
>>>>>> express routes, but the important parts are passport.authenticate calls. 
>>>>>> it's agnostic enough.
>>>>>>
>>>>>> Am Freitag, 15. Februar 2013 01:02:26 UTC+1 schrieb José F. 
>>>>>> Romaniello:
>>>>>>>
>>>>>>> Ob sorry, i nver used passport other than as a connect middleware, 
>>>>>>> and as I said he probabily needs some kind of sessions to store at 
>>>>>>> least 
>>>>>>> the user is logged in. So, i think connect will be easier. But if you 
>>>>>>> know 
>>>>>>> any other way please go ahead
>>>>>>>
>>>>>>> i know also you could use connect and http proxy on the same 
>>>>>>> instance of the http server
>>>>>>>
>>>>>>> El jueves, 14 de febrero de 2013, Bradley Meck escribió:
>>>>>>>
>>>>>>>> Any reason not to use http-proxy and passport without express?
>>>>>>>>
>>>>>>>> --
>>>>>>>> --
>>>>>>>> Job Board: http://jobs.nodejs.org/
>>>>>>>> Posting guidelines: https://github.com/joyent/node
>>>>>>>> /wiki/Mailing-List-Posting-Guidelines
>>>>>>>> You received this message because you are subscribed to the Google
>>>>>>>> Groups "nodejs" group.
>>>>>>>> To post to this group, send email to [email protected]
>>>>>>>> To unsubscribe from this group, send email to
>>>>>>>> [email protected]
>>>>>>>> For more options, visit this group at
>>>>>>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>>>>>>
>>>>>>>> ---
>>>>>>>> You received this message because you are subscribed to the Google 
>>>>>>>> Groups "nodejs" group.
>>>>>>>> To unsubscribe from this group and stop receiving emails from it, 
>>>>>>>> send an email to [email protected].
>>>>>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>>>>>
>>>>>>>>
>>>>>>>>   -- 
>>>> -- 
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-
>>>> Posting-Guidelines
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To post to this group, send email to [email protected]
>>>>
>>>> To unsubscribe from this group, send email to
>>>> [email protected]
>>>>
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>>>  
>>>> --- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "nodejs" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to [email protected].
>>>>
>>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>>  
>>>>  
>>>>
>>>
>>>  -- 
>> -- 
>> Job Board: http://jobs.nodejs.org/
>> Posting guidelines: 
>> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
>> You received this message because you are subscribed to the Google
>> Groups "nodejs" group.
>> To post to this group, send email to [email protected]<javascript:>
>> To unsubscribe from this group, send email to
>> [email protected] <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/nodejs?hl=en?hl=en
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "nodejs" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to