diff --git a/docker-compose/config/mimoto-default.properties b/docker-compose/config/mimoto-default.properties index deffd6d6..d1f0c7a9 100644 --- a/docker-compose/config/mimoto-default.properties +++ b/docker-compose/config/mimoto-default.properties @@ -41,12 +41,12 @@ mosip.inji.minStorageRequired=2 # START bootstrap.properties -spring.cloud.config.uri=http://nginx/ +spring.cloud.config.uri=http://inji-web:3004/ spring.cloud.config.name=mimoto,inji spring.application.name=mimoto #config.server.file.storage.uri=https://raw.githubusercontent.com/mosip/mosip-config/collab1/ -config.server.file.storage.uri=http://nginx/ +config.server.file.storage.uri=http://inji-web:3004/ management.endpoint.health.show-details=always management.endpoints.web.exposure.include=info,health,refresh diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml index 995f9e03..f83e5fd9 100644 --- a/docker-compose/docker-compose.yml +++ b/docker-compose/docker-compose.yml @@ -1,16 +1,6 @@ version: '3.8' services: - nginx: - container_name: nginx - image: nginx:alpine - ports: - - '80:80' - volumes: - - ./config/mimoto-issuers-config.json:/config/server/mimoto-issuers-config.json - - ./config/mimoto-trusted-verifiers.json:/config/server/mimoto-trusted-verifiers.json - - ./config/credential-template.html:/config/server/credential-template.html - - ./nginx.conf:/etc/nginx/nginx.conf mimoto-service: container_name: 'mimoto-service' @@ -25,32 +15,19 @@ services: - SPRING_CONFIG_LOCATION=/home/mosip/ volumes: - ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties - - ./config/mimoto-issuers-config.json:/home/mosip/mimoto-issuers-config.json - - ./config/mimoto-trusted-verifiers.json:/home/mosip/mimoto-trusted-verifiers.json - ./certs/oidckeystore.p12:/home/mosip/certs/oidckeystore.p12 - depends_on: - - nginx - - inji-web-proxy: - container_name: 'inji-web-proxy' - image: inji-web-proxy:local - ports: - - '3010:3010' - environment: - - MIMOTO_HOST=http://mimoto-service:8099/v1/mimoto - - PORT=3010 - depends_on: - - mimoto-service inji-web: container_name: 'inji-web' image: inji-web:local ports: - - '3001:3004' + - '3004:3004' environment: - DEFAULT_LANG=en - - MIMOTO_HOST=http://localhost:3010 + - MIMOTO_HOST=http://localhost:3004/v1/mimoto + volumes: + - ./config/mimoto-default.properties:/home/mosip/mimoto-default.properties + - ./config/mimoto-issuers-config.json:/home/mosip/mimoto-issuers-config.json + - ./config/mimoto-trusted-verifiers.json:/home/mosip/mimoto-trusted-verifiers.json depends_on: - - inji-web-proxy - - + - mimoto-service \ No newline at end of file diff --git a/docker-compose/nginx.conf b/docker-compose/nginx.conf deleted file mode 100644 index 03a3e1d7..00000000 --- a/docker-compose/nginx.conf +++ /dev/null @@ -1,12 +0,0 @@ -events { } - -http { - server { - listen 80; - - location / { - root /config/server; - autoindex on; - } - } -} diff --git a/helm/inji-web/templates/configmap.yaml b/helm/inji-web/templates/configmap.yaml index b9c714b7..9fc9b509 100644 --- a/helm/inji-web/templates/configmap.yaml +++ b/helm/inji-web/templates/configmap.yaml @@ -21,12 +21,6 @@ data: http { access_log /var/log/nginx/access1.log; error_log /var/log/nginx/error1.log; - - # Increase buffer sizes for reading response headers from the upstream server - proxy_buffer_size 16k; # Buffer for the first part of the response header - proxy_buffers 4 16k; # Number of buffers and their size for reading the response - proxy_busy_buffers_size 32k; # Buffer size for busy buffers - server { listen {{ .Values.inji_web.inji_web_port }}; server_name localhost; diff --git a/inji-web/nginx.conf b/inji-web/nginx.conf index b794765f..c2332953 100644 --- a/inji-web/nginx.conf +++ b/inji-web/nginx.conf @@ -1,20 +1,44 @@ server { listen 3004; + # Serve static files, if any + # Default location for normal static files location / { root /usr/share/nginx/html; index index.html index.htm; try_files $uri $uri/ /index.html; } - - location /mimoto/ { - proxy_pass http://192.168.2.186:8089/; + # Serve files from /home/mosip with autoindex enabled + location ~* \.json$ { + root /home/mosip; + autoindex on; } + # Proxy API requests to mimoto-service + location /v1/mimoto/ { + proxy_pass http://mimoto-service:8099/v1/mimoto/; + 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_http_version 1.1; + proxy_set_header Connection ""; + + # Add CORS headers + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; + add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization, Cache-Control' always; + + # Handle OPTIONS requests (for pre-flight checks) + if ($request_method = 'OPTIONS') { + return 204; + } + } + error_page 500 502 503 504 /50x.html; location = /50x.html { - root /usr/share/nginx/html; + root /usr/share/nginx/html; } }