bunkerweb icon indicating copy to clipboard operation
bunkerweb copied to clipboard

[BUG] [stream] Error when using bunkernet:log_stream() during preread with denied IP

Open jojolll opened this issue 5 months ago • 0 comments

What happened?

Hi,

I'm observing a repeated error when using bunkernet:log_stream() in a stream context (proxying TCP connections). The client was denied during preread due to a geolocation blacklist, but an additional error was logged:

This happens during the preread phase, likely because get_headers() isn't available in the stream context — which makes sense. But I wasn’t expecting this to raise a runtime error in the logs.

Not sure if this is something that should be handled differently, or if it’s just a misconfiguration on my side. Just reporting it in case this can be prevented more gracefully.

How to reproduce?

BunkerWeb in stream proxy mode A TCP connection is denied during the preread phase based on GeoIP country Client was from the US, and the country was blacklisted

Configuration file(s) (yaml or .env)


Relevant log output

2025/08/07 17:33:12 [warn] 178453#178453: *366709 [PREREAD] denied preread from country : client IP 162.142.125.209 is in country cache (blacklisted, country = US) while prereading client data, client: 162.142.125.209, server: 0.0.0.0:1961
2025/08/07 17:33:12 [error] 178453#178453: *366709 [LOG] bunkernet:log_stream() failed : /usr/share/bunkerweb/core/bunkernet/bunkernet.lua:216: attempt to call field 'get_headers' (a nil value) while prereading client data, client: 162.142.125.209, server: 0.0.0.0:1961

BunkerWeb version

1.6.3

What integration are you using?

Linux

Linux distribution (if applicable)

Debian VM

Removed private data

  • [x] I have removed all private data from the configuration file and the logs

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

jojolll avatar Aug 07 '25 16:08 jojolll