Hello everyone,
I am using NGINX as an API gateway & currently have 2 Meteor apps, which I want to run. I need to run as per Micro Service Architecture,
Here are the configuration files I have used
worker_processes 4;
events {
worker_connections 1024;
}
http{
server{
listen 3003;
location / {
proxy_pass http://main_web:3000;
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;
}
location ~ ^/group {
rewrite ^/group/(.*) /$1 break;
proxy_pass http://group:3001;
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;
}
}
}
version: '3'
services:
main_web:
container_name: main_web
image: username/parent_web:1.0
environment:
MONGO_URL: ${MONGO_URL}
ports:
- "3000:3000"
restart: always
group:
container_name: group
image: user_name/child_group:0.2
environment:
MONGO_URL: ${MONGO_URL}
ports:
- "3001:3001"
restart: always
depends_on:
- "main_web"
nginx-proxy:
build:
dockerfile: Dockerfile
context: ./proxy
depends_on:
- main_web
- group
ports:
- "3003:3003"
DockerFile for NGINX
FROM nginx
RUN rm /etc/nginx/nginx.conf
COPY nginx.conf /etc/nginx/nginx.conf
With this config, I am able to call the backend APIs for Group (Micro Service) Successfully but when I tries to load the frontend part using HTTP://localhost:3003/groups then its not working, I am getting the blank page with an error 404, scripts not loaded
I believe the issue is related with ROOT_URL but I have tried to change that as well. Still no luck, Please let me know if anyone faced similar thing or knows how to fix the same
Thanks