skip to Main Content

the API endpoints are working in localhost but at the moment I’m deploying it to the server, and some of the endpoints are not working.

http://localhost:xxxx/api/endpoint ==> working

https://myapiurl.com/api/endpoint ==> not working

Here is my Nginx configuration :

root /var/www/html;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name golivegameplan.com www.golivegameplan.com https://golivegameplan.com;

        location / {
                proxy_pass http://localhost:5000;
                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;
                #try_files $uri $uri/ =404;
        }



    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/golivegameplan.com/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/golivegameplan.com/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


}

Is there anything I’m missing?

2

Answers


  1. You might want to check if you’re getting a CORS error.
    Is it functioning in postman?

    Login or Signup to reply.
  2. Have you tried using 0.0.0.0 in the proxy_pass directive instead of localhost?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search