Hi again,

My next try was to remove all original headers (like default implementation do) 
and then preserver only Authentication header.

So I replaced this line:

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

with call to this method:

        private void preserveHeaders(Request request)
        {
                Series<Header> headers = (Series<Header>) 
request.getAttributes().get(HeaderConstants.ATTRIBUTE_HEADERS);
                Series<Header> newHeaders = new Series<Header>(Header.class);

                for (String headerName : headersToPreserve) {
                        Header headerToPreserve = headers.getFirst(headerName);
                        if (headerToPreserve != null) {
                                newHeaders.add(headerToPreserve);
                        }
                }
                request.getAttributes().put(HeaderConstants.ATTRIBUTE_HEADERS, 
newHeaders);
        }

where 

        headersToPreserve = Arrays.asList(HeaderConstants.HEADER_AUTHORIZATION)

After this change, the response from proxy is always:

HTTP/1.1 1002 Internal Connector Error
Date: Fri, 18 Apr 2014 08:01:10 GMT
Accept-Ranges: bytes
Server: Restlet-Framework/2.1.4
Content-Length: 484
Content-Type: text/html; charset=UTF-8

I am somehow abandoning the idea of using Restlet as a transparent reverse 
proxy, but anyway, I've attached a small example of test implementation if 
someone will have time and willpower to look at it.

Tim, thank you for your support!

Any advices on how could I achieve Digest/Basic authentication to work on 
backend server when in front of it is a proxy are still welcome.

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

Attachment: RestletReverseProxyTest.rar
Description: Binary data

Reply via email to