-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Answer redirect by filter for direct proxy requests trick is broken #222
Comments
One of the changes in #204 is that connections won't be automatically closed after short-circuit responses. Generally this is a good thing, but if you were relying on the automatic connection closure to indicate "end-of-message", it may cause your responses to "hang". You can force LP to close the connection by adding the "Connection: close" header to your short-circuit responses. Alternately, you can enable chunked Transfer-Encoding, or set an appropriate Content-Length. See RFC 7230, section 3.3.3 for details on indicating message body length. |
Thank you, the redirect works well with: HttpHeaders.setHeader(answer, Names.CONNECTION, Values.CLOSE); A Content-Length is working only, if the message has a content, since a length of 0 hasn't worked for me. |
Glad it's working for you. Content-Length of 0 should work, though (assuming there is no entity body on your message). What happened when you set Content-Length to 0? |
I've tried a redirect by a DefaultHttpResponse (no Full) without a content, without Connection: close header, but with Content-Length: 0 header. -> This won't fix the blocking behavior. |
Did you try with a DefaultFullHttpResponse with a Content-Length: 0 header? It shouldn't make a difference if there is no entity content, but I'd like to investigate further. Did you have aggregation turned on (i.e. non-zero buffer values in the HttpFiltersSourceAdapter)? The test you linked to earlier in this issue seems to be gone -- do you have a test or a snippet of code that you know hangs with Content-Length 0? I'd like to try to get it fixed, because always closing connections is not a very efficient way to use a proxy server. (As an alternative, for now, you could set the Transfer-Encoding to Chunked instead of adding the Connection: close header.) |
Hi Jason, use this Test Aggregation was off in the test, but it's always on in my proxy, where Answering content works well. So closing on redirect is not a problem Am 31.07.2015 um 16:53 schrieb Jason Hoetger:
|
I've built a caching proxy server, which provides a Web UI for its contents or browsing history and for full text search results. This is implemented with filters which answers responses with content, errors or with a 302 Found state to redirect. Redirects are neccessary for the modify/redirect pattern. It works fine with LittleProxy up to 78e41b2.
@jekh I think it's introduced with #204. Please, have a look at this test. It's working in this branch, but it fails in master.
Update: fails means: the browser is not redirected to another URL and waits until timeout occours.
The text was updated successfully, but these errors were encountered: