diff --git a/safeshare/K8s/frontend_deployment.yaml b/safeshare/K8s/frontend_deployment.yaml index b0059f0..50d5a31 100644 --- a/safeshare/K8s/frontend_deployment.yaml +++ b/safeshare/K8s/frontend_deployment.yaml @@ -20,11 +20,6 @@ spec: containers: - name: safeshare-frontend image: itsmexrando/safeshare-frontend:latest - imagePullPolicy: IfNotPresent - env: - - name: REACT_APP_API_HOST - value: safeshare-backend-service - - name: REACT_APP_API_PORT - value: "80" + imagePullPolicy: Always ports: - containerPort: 80 diff --git a/safeshare/safeshare-frontend/Dockerfile b/safeshare/safeshare-frontend/Dockerfile index 5b8b6ea..6c31f13 100644 --- a/safeshare/safeshare-frontend/Dockerfile +++ b/safeshare/safeshare-frontend/Dockerfile @@ -14,8 +14,8 @@ FROM nginx:alpine AS production-stage # Copy the built app from the build stage COPY --from=build-stage /frontend/build /usr/share/nginx/html -# Use a custom nginx.conf (optional but can be useful) -# COPY nginx.conf /etc/nginx/conf.d/default.conf +# Use a custom nginx.conf +COPY nginx.conf /etc/nginx/conf.d/default.conf # Expose port 80 EXPOSE 80 diff --git a/safeshare/safeshare-frontend/nginx.conf b/safeshare/safeshare-frontend/nginx.conf new file mode 100644 index 0000000..3e94bd9 --- /dev/null +++ b/safeshare/safeshare-frontend/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + + location / { + root /usr/share/nginx/html; + try_files $uri $uri/ /index.html; + } + + location /api/ { + proxy_pass http://safeshare-backend-service:80; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + } +} diff --git a/safeshare/safeshare-frontend/src/pages/shareFile.js b/safeshare/safeshare-frontend/src/pages/shareFile.js index b39a737..00bab7e 100644 --- a/safeshare/safeshare-frontend/src/pages/shareFile.js +++ b/safeshare/safeshare-frontend/src/pages/shareFile.js @@ -43,9 +43,6 @@ function ShareFile() { const handleFileUpload = (file) => { setFile(file); - //setPasscode('1234'); - console.log(file); - console.log(apiUrl); if (file) { const formData = new FormData(); formData.append('file', file);