admin管理员组文章数量:1290226
We are facing an issue where the first API call in our React Native app takes 45-60 seconds due to a slow SSL handshake. After the initial request, subsequent API calls work fine.
Our setup is as follows:
- Backend: Tomcat (Serving APIs)
- Reverse Proxy: Nginx (Handles SSL termination)
- Mobile App: React Native (Using Redux Toolkit Query for API calls)
- SSL Certificate: Let's Encrypt (Installed on Nginx)
Issue:
Whenever a user opens the app for the first time, the initial API request triggers an SSL handshake delay of 45-60 seconds. This happens only on the first request, and subsequent requests are fast.
What We Have Tried:
Enabled SSL Session Resumption in Nginx (ssl_session_cache)
ssl_session_cache shared:SSL:50m; ssl_session_timeout 4h; ssl_session_tickets on; keepalive_timeout 75s; keepalive_requests 100;
Result: No major improvement.
Preloaded API Calls in React Native (useEffect)
useEffect(() => { triggerGetData(); // Preload API call to warm up SSL connection }, []);
Result: Helped slightly, but still slow for first-time users.
Enabled HTTP/2 in Nginx
listen 443 ssl http2;
Result: No noticeable improvement.
Checked SSL Handshake Timing Using OpenSSL
openssl s_client -connect yourdomain:443 -showcerts -time
Result: Handshake took ~15 sec on first request but was fast on retries.`
本文标签:
版权声明:本文标题:First SSL Handshake Takes 45-60 Seconds on Initial API Call (Nginx Reverse Proxy, Tomcat, RTK Query, React Native, Let's 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741211544a2359220.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论