0

I want to call my api point in my react application. Here when I access the localhost then my react app opens up but all the api points doest work when I hit "localhost/apipoint". this shows me 404 not found or 502 bad request.

Here is my docker-compose file

version: "3.8"
services:
    nodeserver:
        build:
            context: ./Backend
        networks:
            - app-network
        ports:
            - "8082:8082"
    frontend:
        build:
            context: ./Frontend
        networks:
            - app-network
        ports:
            - "80:80"
networks:
    app-network:

my nginx default.conf

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

    server_name _;

    location /apipoint {
        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 $scheme;

        proxy_pass http://localhost:8082;
    }
    location / {
        # root /usr/share/nginx/html;
        root /var/www/html;
    }
}
Janez Kuhar
  • 3,705
  • 4
  • 22
  • 45
Manas S. Roy
  • 303
  • 1
  • 10

0 Answers0