Welcome! Log In Create A New Profile

Advanced

NGINX not routing calls from react app to backend app

Posted by dontke1@gmail.com 
NGINX not routing calls from react app to backend app
April 03, 2019 02:38PM
I have an AWS Ubuntu server that hosts a react front end running at 127.0.0.1:4100 and calls a Go app using ports 127.0.0.1:1323.I installed Nginx and setup proxy pass for these two ports in /etc/nginx/sites-available/default config file but I only get the front end getting passed by Nginx. Using chrome inspect to check why the Go app is not serving some of the functionalities from the react app, I get this error

client.js:772 GET http://127.0.0.1:1323/api/ net::ERR_CONNECTION_REFUSED
ERROR Error: Request has been terminated Possible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.

What am I doing wrong? Below is my default config file

server {

listen 80 default_server;
listen [::]:80 default_server;

server_name _;

location / {

proxy_pass http://127.0.0.1:4100;

}

location /api {

proxy_pass http://127.0.0.1:1323/;

}
}
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 80
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready