Hello, Trying to deploy two servers using cloudfla...
# server
e
Hello, Trying to deploy two servers using cloudflare configuration with subdomains and reverse proxy. api1.domain.com and api2.domain.com. The server 1 is ktor running on 8080 and server 2 is running on 8081. On each server, I have a GET method that returns a hello message. However, calling GET http://api1.domain.com/ returns "Hello from api1" and GET http://api2.domain.com/ is also returning "Hello from api1" instead of forwarding to the second server and returning "Hello from api2". When specifying the port explicitily, it works fine.
Copy code
server {
 listen 80;
 listen [::]:80;
 listen 443 ssl http2;
 listen [::]:443 ssl http2;
 ssl_certificate_key /etc/nginx/ssl-certificates/api2.domain.com.key;
 ssl_certificate /etc/nginx/ssl-certificates/api2.domain.com.crt;
 server_name api2.domain.com;
 root /home/x-api2/htdocs/api2.domain.com;

location @reverse_proxy {
  proxy_pass <http://localhost:8081>;
  proxy_http_version 1.1;
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Server $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 $scheme;
  proxy_set_header Host $http_host;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "Upgrade";
  proxy_pass_request_headers on;
  proxy_max_temp_file_size 0;
  proxy_connect_timeout 900;
  proxy_send_timeout 900;
  proxy_read_timeout 900;
  proxy_buffer_size 128k;
  proxy_buffers 4 256k;
  proxy_busy_buffers_size 256k;
  proxy_temp_file_write_size 256k;
 }

location / {
  try_files $uri @reverse_proxy;
 }
}
I have the same config for api1 and it's working
not kotlin but kotlin colored 1