-
Notifications
You must be signed in to change notification settings - Fork 777
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
Handle exceptions in filter implementations #113
Comments
Oh yeah, that would be useful, wouldn't it? What if I changed the signature of |
That would work for me |
I've deployed beta4-SNAPSHOT, so this should be available now. |
I'm not sure this is really working for me. I'm most likely to be handling an error when dealing with a LastHttpContent instance and by then I will have processed and returned the initial HttpResponse and potentially some HttpContent instances as well. What happens to them? Have they not already been sent back to the client at that point? Should I instead aggregate everything and return a single FullHttpResponse? What I'm seeing in one test is a 200 response and in another an exception is thrown inside LittleProxy that I've pasted in below. In both cases the behavior should really be the same as I'm testing two variations of the same condition so there's more than likely something I'm doing incorrectly.
|
Can you tell me a little bit more about your use case please? If you detect an error condition on the LastHttpContent, do you want to have sent anything to the client? If not, then you are correct that you'll need to aggregate everything before filtering. This is already supported in LittleProxy by having your |
In my case if anything goes wrong during response processing it's catastrophic. All I'd really like is to get a 502 back to say the proxy has experienced an error. Right now the connection aborts. |
In that case, I think |
@robfletcher Let me know if this gets you what you need. If not, let's figure out what will work. |
@oxtoacart Not sure if my request is exactly the same but I did not want to create a duplicate. For the project I'm working on I would like to modify the responses so that I can insert JavaScript into HTML from a server. Would this be possible with this fix? I don't see a way of doing this with the latest release. Let me know If I have to file a separate issue. I could also try to provide a fix if needed, although that would take some time. Thanks! |
@alexnederlof Yes, this should work for you. In your Then, in your |
Nice! I'll give it a shot. Thanks for the quick reply! |
If you're using Selenium, or any browser for that matter, you can just pass the PAC file name into the Selenium config or the browser startup switches and use a basic JS function to ignore the Websockets connections (e.g. URL starts with |
If I run into an unrecoverable error in a filter is there a way for me to hand off to an exception handler so that the proxy returns an error response? This is easy enough to do in
requestPre
andrequestPost
since I can construct and return my own response but I can't see a way to do it inresponsePre
orresponsePost
.The text was updated successfully, but these errors were encountered: