𝗦𝗲𝗿𝘃𝗲𝗿 𝗖𝗼𝗻𝗳𝗶𝗴𝘂𝗿𝗮𝘁𝗶𝗼𝗻

Proper server setup is vital for production web applications. Hyperlane gives you two ways to manage your server: ServerConfig and RequestConfig.

ServerConfig manages the HTTP server itself. You use it to set:

  • Address: Use 0.0.0.0:80 to listen on all interfaces. Use 127.0.0.1:8080 to restrict to your local machine.
  • Nodelay: Set this to true to reduce latency. It sends small packets immediately instead of buffering them.
  • TTL: This sets the Time to Live for outgoing packets. A value of 128 works for most cases.

RequestConfig manages individual HTTP requests. This protects your server from resource exhaustion and attacks. You can set these limits using JSON:

  • buffer_size: The read buffer size in bytes.
  • max_path_size: The maximum URL path length.
  • max_header_count: The limit on headers per request.
  • max_body_size: The maximum allowed request body. This prevents denial-of-service attacks.
  • read_timeout_ms: The time limit for reading request data.

Hyperlane lets you load these settings from a JSON string. This makes it easy to use environment variables in containerized environments.

Best practices for production:

  • Use JSON for configuration. It makes deployments flexible.
  • Set strict request limits. Match your max_body_size to your actual needs.
  • Enable nodelay for API servers to keep latency low.
  • Set read timeouts. This stops slow clients from holding connections open.
  • Bind to specific interfaces instead of 0.0.0.0 when possible.

Hyperlane gives you control through code or JSON. This two-tier approach ensures your server stays fast and secure.

Project Code: https://github.com/hyperlane-dev/hyperlane Source: https://dev.to/tengxgfyrz67s/server-configuration-1dp9