Releases: iwater/react-native-nitro-http-server
v1.6.0: fix(android): enable 16KB page alignment
v1.5.2: chore: update to nitro modules 0.32.0 and improve build config
chore: update to nitro modules 0.32.0 and improve build config
- Update dependencies to 0.32.0 versions
- Add nitro-buffer dependency
- Make Android SDK versions configurable
- Simplify package.json structure
- Bump version to 1.5.2
v1.5.1
v1.5.0
Convert Rust libraries to dynamic framework architecture
Summary
transformed Rust libraries from static to dynamic frameworks to resolve symbol conflicts and streamline iOS build process.
Changes
-
Build Scripts:
- Updated to generate
.dylibinstead of.astatic libraries - Added
install_name_toolto fix runtime search paths - Modified XCFramework creation to use
.frameworkbundles - Simplified library export configuration in
Cargo.toml
- Updated to generate
-
Podspec Updates:
- Removed
s.libraries = "c++", updated header paths for framework structure
- Removed
-
XCFramework Structure:
- Created proper
.frameworkbundles with Info.plist and binary - Framework sizes reduced due to stripped dependencies
- Removed global symbol exports (no more
rust_eh_personalityconflicts)
- Created proper
Key Benefits
✅ Resolves iOS symbol conflicts between multiple Rust libraries
✅ Reduces binary size through proper dependency management
✅ Maintains backward compatibility with existing React Native integration
✅ Simplifies iOS build configuration (no manual static linking needed)
The dynamic framework architecture follows iOS best practices and eliminates the need for workarounds like "force load" or symbol renaming, creating a cleaner and more maintainable build system.
v1.4.0
Add WebSocket plugin with new onWebSocket API
Summary
Implemented a comprehensive WebSocket plugin with new API design (Scheme B) that provides separate WebSocket event handlers with full access to HTTP upgrade request information.
Changes
-
TypeScript API (
index.ts,HttpServer.nitro.ts):- Introduced new
onWebSocket(path, handler)API on ConfigServer - Added
ServerWebSocketclass with W3C-compatible API (send(),close(),onmessage, etc.) - Enhanced event types with full HTTP upgrade information (path, query, headers)
- Introduced new
-
C++ Bridge (
HybridHttpServer.cpp):- Implemented WebSocket event forwarding from Rust to JavaScript
- Added WebSocket operation methods for JavaScript API
Key Features
✅ Full W3C WebSocket API compatibility in JavaScript layer
✅ Separate WebSocket handler API with request context access
✅ Full HTTP upgrade information (path, query, headers) available to handlers
✅ Connection management with unique IDs for message routing
✅ Support for both text and binary message types
✅ Comprehensive error handling and cleanup
API Design
server.onWebSocket('/ws', (ws, request) => {
console.log('Path:', request.path);
console.log('Query:', request.query); // e.g., "token=abc&user=123"
console.log('Headers:', request.headers); // Full HTTP upgrade headers
ws.onmessage = (e) => {
ws.send('Echo: ' + e.data);
};
ws.onclose = () => {
console.log('Connection closed');
};
});The WebSocket plugin enables real-time bidirectional communication while maintaining full access to HTTP upgrade context, making it suitable for authentication and WebSocket routing scenarios.
v1.3.4
Add URL rewrite plugin with regex support
Summary
Implemented a URL rewrite plugin that supports multiple regex-based rewrite rules with capture group replacement functionality.
Changes
-
Rust Plugin:
- Created new plugin with
RewriteRulestruct supporting pattern/replacement pairs - Added
regexcrate dependency for pattern matching - Implemented sequential rule processing with capture group replacement
- Created new plugin with
-
TypeScript Types (
HttpServer.nitro.ts):- Added
RewriteMountinterface withrulesarray - Extended
Mountableunion type to include rewrite plugin - Added
RewriteRuleinterface for pattern/replacement configuration
- Added
-
Documentation:
- Updated README files with plugin description and configuration examples
Key Features
✅ Multiple regex-based rewrite rules in array format
✅ Capture group replacement support ($1, $2, etc.)
✅ Sequential rule processing with first-match wins
✅ Flexible configuration for path transformations
The rewrite plugin enables powerful URL manipulation capabilities similar to nginx rewrite rules, supporting use cases like API versioning, path normalization, and URL cleanup.
v1.3.3
Add buffer upload plugin with ArrayBuffer support
Summary
Implemented new Buffer Upload Plugin that processes file uploads in memory and passes data as ArrayBuffer to JavaScript callbacks, along with necessary framework updates.
Changes
-
Rust Plugin :
- Created new plugin to handle file uploads in memory (100MB limit)
- Stores file contents directly into request body as binary data
- Adds upload metadata (filename, size, content-type) to request headers
-
TypeScript Definitions (
HttpServer.nitro.ts):- Added
BufferUploadMountinterface withtype: 'buffer_upload' - Updated
Mountableunion type to include new plugin - Enhanced
HttpRequestinterface withbinaryBody?: ArrayBufferfield
- Added
-
C++ Bridge Fix (
HybridHttpServer.cpp):- Fixed binary data handling for Nitro modules
- Added proper detection for buffer upload requests via headers
-
Documentation (
README.md,README_zh.md):- Added plugin to features list
- Included configuration examples
- Updated type definitions and FAQ section
- Explained differences between disk-based and memory-based uploads
Key Features
✅ In-memory file upload processing (up to 100MB)
✅ Direct ArrayBuffer access in JavaScript callbacks
✅ Seamless integration with existing mount-based architecture
✅ Comprehensive type safety with TypeScript definitions
✅ Fixed C++ compilation issues for binary data handling
The buffer upload plugin provides efficient in-memory processing for smaller files while maintaining compatibility with the existing upload infrastructure.
v1.3.2
Add file upload plugin and fix header parsing in C++ bridge
Summary
Implemented a new file upload plugin in Rust and fixed critical header parsing issue in the C++ bridge.
Changes
-
Rust Upload Plugin:
- Created
uploadplugin for handling multipart file uploads - Saves uploaded files to configurable temp directory
- Adds upload metadata to request headers for JS callback processing
- Created
-
TypeScript Types:
- Added
UploadMountinterface and integrated intoMountableunion type - Updated TypeScript definitions to support new plugin type
- Added
-
Documentation Updates:
- Updated README files with upload plugin examples and documentation
- Added comprehensive test page for file upload functionality
-
C++ Bridge Fix:
- Fixed critical bug where request headers were not being parsed from JSON
- Headers are now properly deserialized from
headers_jsonfield and passed to JS callbacks - Removed
.value()call from non-optional headers map
Features
✅ File upload support via multipart/form-data
✅ Configurable temporary directory for uploads
✅ Upload metadata passed to JS callbacks
✅ Updated test page with file upload UI
✅ Fixed headers parsing for all request types
The upload plugin enables secure file handling in Rust while maintaining flexibility for JS-based processing logic.
v1.3.1
v1.3.0
Refactor ServerConfig to unified mount-based architecture
Summary
Replaced separate plugin configurations with a unified mounts array in ServerConfig, allowing multiple instances of each plugin type with explicit routing priority control.
Changes
- TypeScript: Updated ServerConfig interface to support discriminated union types for mounts (webdav, zip, static)
- Rust backend: Refactored AppHttpServer to dynamically instantiate plugins from mounts array instead of hardcoded registration
- Plugins: Modified StaticFilePlugin, WebDavPlugin, and ZipMountPlugin to accept mount_path during construction and properly strip prefixes
- Documentation: Updated README files with new API examples and created detailed refactor plan
- Tests: Migrated all test cases to new configuration format
Key Features
- ✅ Unified configuration through
mountsarray with explicit routing priority - ✅ Support for multiple instances of each plugin type
- ✅ Maintains JS callback as ultimate fallback for unhandled requests
- ✅ Preserves backward compatibility through
root_dirfield - ✅ Clean separation between static serving and dynamic request handling
The new architecture provides Nginx-like routing flexibility while maintaining the hybrid server model's core principle: static serving first, dynamic JS fallback.