I have a web app that uses angular as client, springboot for microservices and mysql as db. a couple of days ago i have added a domain to the site and today i used lets encrypt to create an ssl certificate.
the project is run on an ubuntu vm with docker compose
reverse-proxy file for the domain below
server { server_name full_domain_name; location / { proxy_pass http://local_ip:4200/ ; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/full_domain_name/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/full_domain_name/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot}# Redirect HTTP to HTTPSserver { if ($host = full_domain_name) { return 301 https://$host$request_uri; } listen 80; # HTTP server_name full_domain_name; return 404; # Managed by Certbot}
the thing is after upgrading to https, the api calls stopped working.error on client console: net::ERR_SSL_PROTOCOL_ERROR
error in microservice: 2024-11-23T20:06:54.862Z INFO 1 --- [event] [nio-8081-exec-1] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request headerNote: further occurrences of HTTP request parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name [(characters)]. HTTP method names must be tokens
i tried updating api calls to use http instead and (of course) it wouldnt work because it is an insecure (and stupid) way of doing it: Mixed Content: The page at 'https://full_domain_name/' was loaded over HTTPS, but requested an insecure resource 'http://full_domain_name:8081/api/endpoint'. This request has been blocked; the content must be served over HTTPS.
i also tried to have nginx as a separate service in docker compose and specify the nginx.conf file in the project but that just overcomplicates the project atm