-
Notifications
You must be signed in to change notification settings - Fork 503
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
Encounter a strange issue when using rewrite_by_lua_block to authoriacate connect request. #264
Comments
For the cases of (1.), if proxy_connect module is enabled to handle the CONNECT request, the response of CONNECT request will be generated individually by this module, skipping the nginx output header / response filter. As a result, you cannot modify the response via the nginx header/response filter module, such as However there is an exception for nginx REWRITE module including
or return response directly in lua-nginx-module rewrite phase
|
For case (2.), pls ensure you are correctly encapsulating the HTTP response. The code you provided is incorrect and should be replaced with
After debugging your original code, I found that the response was invalid, see the following tcpdump log log of my debugging with righ lua code
|
And also note that if the proxy_connect module fails to resolve the proxied backend (DNS resolve), you may receive a 503 status code as a response. In such cases, the To see my test for a non-existent proxied backend domain, please refer to the following. |
Dear developer,
I am using ngx_http_proxy_connect_module to proxy requests from https to http server. However, I encountered a strange issue that lacks logic and I hope you can take a deep look into it and investigate the possible reasons and solutions.
The symptom of the problem is that
i had hoped that i would get a 403. but what i got is good request.
"CONNECT www.google.com:443 HTTP/1.1" 200 22173 "-" "curl/7.74.0" "-"
2. the following code is not work
i had hoped that i would get a 403. but i got 200 without html body and hanging.
3. the following code is not work
i had hoped that i would get a 403. but i got 200 without html body and not hanging.
i found some code is good:
1.
but i can not set html body for them.
I have tried to investigate this issue myself but I failed to find any clue about it. I wonder if you could provide some guidance on how to debug this issue, or if there is any configuration or parameter I should set to prevent this issue from happening again.
Thank you very much for your help in advance.
Best regards,
L. Fee
The text was updated successfully, but these errors were encountered: