Question

How can I connect my postgREST http upstream to my Digital Ocean app?

Posted November 14, 2020 63 views
NginxDigitalOcean App Platform

Greetings, I’m trying to connect my postgREST API that’s running from my droplet, to my main domain that’s on Digital Ocean’s app platform. I’m a little confused on how to do so because I cannot manually configure my main domain’s VM. I’m pretty new with networking like this but I believe I’m looking to set up a proxy?

Given from postgREST documentation, the nginx config file looks something like this. if my domain name from the App platform is called, DOMAIN.com, where would that be configured here? I only want my postgREST running on localhost in the VM, but can be accessed using my domains http address.

http {
  ...
  # upstream configuration
  upstream postgrest {
    server localhost:3000;
    keepalive 64;
  }
  ...
  server {
    ...
    # expose to the outside world
    location /api/ {
      default_type  application/json;
      proxy_hide_header Content-Location;
      add_header Content-Location  /api/$upstream_http_content_location;
      proxy_set_header  Connection "";
      proxy_http_version 1.1;
      proxy_pass http://postgrest/;
    }
    ...
  }
}

Would really appreciate some guidance here. thank you!

edited by bobbyiliev
Submit an answer

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!