Add support for UNIX socket in Octane Swoole server #1032
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds support for running the Laravel Octane Swoole server via a UNIX domain socket (UDS), instead of the default TCP host/port combination.
Benefit to end users:
Using a UNIX socket can offer better performance and security when deploying Laravel behind a local reverse proxy like Nginx. It avoids unnecessary TCP overhead, simplifies internal routing, and reduces the potential attack surface by keeping inter-process communication on the filesystem.
Why it doesn’t break existing features:
This change is non-breaking and fully backward compatible.
If the sock is not set, Octane continues to use the standard host and port settings.
How it improves developer experience:
Developers using Swoole in Docker or on Linux servers now have the flexibility to bind the Octane server to a UNIX socket file.
This allows easier integration with services like Nginx (fastcgi_pass or proxy_pass to unix:/...) and enhances performance in high-throughput environments.
Notes:
This feature is ignored on Windows, as UNIX domain sockets are not supported there.
Let me know if you’d like help documentation updates to go along with the feature.
#1031