I’m having trouble getting my React frontend to talk to my Spring Boot backend. They’re both located on the same droplet with Nginx handling SSL, yet I keep encountering an SSL protocol error. I’ve experimented with various ports, DNS addresses, and switching between HTTP and HTTPS, but nothing works. I expected them to connect easily since they reside on the same machine, but I’m stuck.
Here’s my revised setup:
// Example backend CORS configuration
@Override
public void registerCors(OriginRegistry registry) {
registry.allowPattern("/**")
.forOrigins("https://www.mysite.com", "http://localhost:3000")
.withMethods("GET", "POST", "PUT", "DELETE")
.enableCredentials();
}
# Sample Docker configuration
version: '3.8'
services:
application:
build: .
ports:
- "80:80"
- "443:443"
volumes:
- /path/to/ssl/certificate:/ssl/certificate:ro
- /path/to/ssl/key:/ssl/key:ro
restart: unless-stopped
# Sample Nginx server configuration
server {
listen 443 ssl;
server_name www.mysite.com;
ssl_certificate /ssl/certificate;
ssl_certificate_key /ssl/key;
# Additional SSL settings here
location / {
root /var/www/html;
try_files $uri $uri/ /index.html;
}
}
// Frontend API configuration
const API_BASE_URL = "https://123.45.67.89:8080";
const ACCOUNT_ENDPOINT = `${API_BASE_URL}/account`;
const SCORE_ENDPOINT = `${API_BASE_URL}/score`;
Any suggestions on how to resolve this error?