Re: Transparent reverse proxying using org.restlet.routing.Redirector

2014-04-17 Thread Tim Peierls
The code that does the header removal is here:

https://github.com/restlet/restlet-framework-java/blob/2.2/modules/org.restlet/src/org/restlet/routing/Redirector.java#L405-L413

If you're confident that that's what you want, you can extend Redirector
and override serverRedirect to do everything it normally *except* remove
those headers.

--tim



On Wed, Apr 16, 2014 at 9:52 AM, Primož Kokol primoz.ko...@gmail.comwrote:

 I am trying to create a transparent reverse proxy using
 org.restlet.routing.Redirector.

 For the sake of simplicity let's say all I want to do is to redirect all
 requests pointing at

 http://localhost:80

 to be dispatched to another unrelated server:

 http://localhost:8080

 I've wrote a simple reverse proxy using Redirector (MODE_SERVER_OUTBOUND
 mode) and it actually works as expected in the sense that it dispatches
 requests properly and also handles redirects.

 But now let's say that resources at http://localhost:8080 are protected
 with Digest authentication mechanism.

 Now the problem is that headers in requests and responses when handled by
 Redirector are removed which makes Digest authentication mechanism unusable.

 From docs WRT MODE_SERVER_OUTBOUND:
 
 Note that in this mode, the headers of HTTP requests, stored in the
 request's attributes, are removed before dispatching. Also, when a HTTP
 response comes back the headers are also removed.
 

 Is there any way to leave headers intact so that end server (
 http://localhost:8080) and clients could communicate as there is no proxy
 in between?

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3076621


--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3076672

RE: Re: Transparent reverse proxying using org.restlet.routing.Redirector

2014-04-17 Thread Primož Kokol
Tim, thanks for advice.

That is actually one of the first things I've tried.

After extending Redirector and overriding serverRedirect  method so that line 
which clears the headers was removed 1002 Internal Connector Error was always 
returned as response (from proxy) so I thought this was not the right approach.

Any idea what could be cause of 1002 Internal Connector Error in this case?

--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3076674


Re: Re: Transparent reverse proxying using org.restlet.routing.Redirector

2014-04-17 Thread Tim Peierls
I'm guessing you have to very selective about which headers you allow to
remain.


On Thu, Apr 17, 2014 at 3:08 PM, Primož Kokol primoz.ko...@gmail.comwrote:

 Tim, thanks for advice.

 That is actually one of the first things I've tried.

 After extending Redirector and overriding serverRedirect  method so that
 line which clears the headers was removed 1002 Internal Connector Error was
 always returned as response (from proxy) so I thought this was not the
 right approach.

 Any idea what could be cause of 1002 Internal Connector Error in this case?

 --

 http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3076674


--
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447dsMessageId=3076675