Hashim
CDCloudflare Developers
•Created by Hashim on 1/9/2025 in #pages-help
Cloudflare SSL Termination with Nginx - "Upgrade Required" and CORS Issues on HTTPS Requests
I am setting up an application with the following architecture:
Frontend (React): Sends HTTPS API requests to the backend through the Nginx reverse proxy.
Backend (Express.js): Handles API requests directly at http://backend-server:8080/.
NGINX: Acts as a reverse proxy, routing traffic from https://api.example.com to the backend.
Cloudflare SSL: Provides SSL certificates for secure HTTPS communication and subdomain .
Current Functionality
HTTP requests: Work without issues.
WebSocket connections: Successfully established and functioning.
HTTPS requests (e.g., https://api.example.com/api/queue): Failing with CORS errors.
Health check endpoint (e.g., https://api.example.com/api/health): Returns "Upgrade Required" error due to backend behavior.
Pipeline Configuration
Frontend (React):
Sends requests to https://api.example.com.
Uses HTTPS for secure communication.
Backend (Express.js):
Listens on http://backend-server:8080.
Hosts API endpoints, including /api/queue and /api/health.
NGINX Reverse Proxy:
Routes HTTPS traffic from https://api.example.com to the backend.
Configured with Cloudflare-origin SSL certificates.
Cloudflare SSL:
Provides TLS termination for secure HTTPS connections.
4 replies