Report this

What is the reason for this report?

Communication between apps on digital ocean app platform

Posted on January 24, 2023

I have a frontend, multiple backend api apps on digital ocean app platform. I deployed them successfully. On the frontend app I use nginx to serve my vue app and define proxy to my backend api apps. When I try to make request from frontend to backend I got error about SSL

[myfrontend-app] [2023-01-23 17:55:44] 2023/01/23 17:55:44 [error] 20#20: *9 SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream, client: 10.33.44.55, server: , request: "POST /api/v1/auth/tokens/ HTTP/1.1", upstream: "https://104.11.211.77:80/api/v1/auth/tokens/", host: "myfrontend-app-abcdef.ondigitalocean.app", referrer: "https://myfrontend-app-abcdef.ondigitalocean.app/login"

Here is my nginx conf

upstream be-app-1 {
server be-app-1-abc.ondigitalocean.app;
}

upstream be-app-2 {
server be-app-2-def.ondigitalocean.app;
}

upstream be-app-3 {
server be-app-3-ghi.ondigitalocean.app;
}


server {
listen 80;
listen [::]:80;

# The root directory of the Vue.js application
root /usr/share/nginx/html;

# Serve the index.html file for all requests
index index.html;

# Serve the Vue.js application's static files
location / {
try_files $uri $uri/ /index.html;
}
location ~ ^/api/v1/auth/(.*) {
proxy_pass https://be-app-1/api/v1/auth/$1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_ssl_server_name on;
}
location ~ ^/api/v1/pro/(.*) {
# using $1 in the target. Example; offenders/ AND $is_args$arg are for Http query params
proxy_pass https://be-app-2/api/v1/pro/$1$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
location ~ ^/api/v1/vro/(.*) {
proxy_pass https://be-app-3/api/v1/vro/$1$is_args$args;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
}
}

Any help would be great!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.