https://github.com/kaltura/nginx-stream-preread-str-module
https://github.com/kaltura/nginx-stream-preread-str-module
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/kaltura/nginx-stream-preread-str-module
- Owner: kaltura
- License: agpl-3.0
- Created: 2022-10-08T07:54:54.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-25T12:54:13.000Z (almost 3 years ago)
- Last Synced: 2025-07-04T13:06:25.134Z (3 months ago)
- Language: C
- Size: 20.5 KB
- Stars: 3
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nginx Stream Pre-read Str Module
Nginx module for reading a string "header" from a stream connection.
The string is consumed up to a predefined delimiter, and is exposed as a stream variable.## Build

To link statically against nginx, cd to nginx source directory and execute:
./configure --add-module=/path/to/nginx-stream-preread-str-module --with-stream
To compile as a dynamic module (nginx 1.9.11+), use:
./configure --add-dynamic-module=/path/to/nginx-stream-preread-str-module --with-stream
In this case, the `load_module` directive should be used in nginx.conf to load the module.
## Configuration
### Sample configuration
```
# Dynamic TCP -> TLS proxy
stream {
server {
listen 5432;preread_str_delim '\n';
proxy_pass $preread_str;
proxy_ssl on;resolver 8.8.8.8;
}
}
```### Configuration directives
#### preread_str_delim
* **syntax**: `preread_str_delim delim;`
* **default**: ``
* **context**: `stream, server`Consumes data from the incoming connection up to the provided delimiter.
The consumed data is not seen by any content phase handlers (for example, `proxy_pass` will not proxy it),
but can be accessed using the `$preread_str` variable.
If the delimiter is not found after reading `preread_buffer_size` bytes (defined in nginx stream core), the connection is dropped.## Embedded Variables
* `$preread_str` - the string that was read from the stream connection.
## Copyright & License
All code in this project is released under the [AGPLv3 license](http://www.gnu.org/licenses/agpl-3.0.html) unless a different license for a particular library is specified in the applicable library path.
Copyright © Kaltura Inc. All rights reserved.