apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-conf-production
data:
  nginx.conf: |
    user nginx;
    worker_processes  1;
    error_log  /dev/stdout;
    events {
      worker_connections  10240;
    }
    http {

      access_log  /dev/stdout;
      server {
        listen 80;
        server_name careapi.coronasafe.network;
        client_max_body_size 50M;
        # Hack to enforce SSL. 

        if ($http_x_forwarded_proto != "https") {
          return 301 https://$host$request_uri;
        }

        access_log /dev/stdout;
        error_log /dev/stdout;
        location / {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
          proxy_pass http://care-django-production:9000;
        }
      }

      server {
        listen 80;
        server_name care.coronasafe.network;
        client_max_body_size 50M;

        if ($http_x_forwarded_proto != "https") {
          return 301 https://$host$request_uri;
        }
       add_header Content-Security-Policy "default-src 'none';script-src https://cdn.coronasafe.network https://cdn.jsdelivr.net/emojione/2.2.7/lib/js/emojione.min.js https://sentry.io https://kit.fontawesome.com/7ef943e539.js https://www.google.com/recaptcha/api.js https://static.cloudflareinsights.com 'self' ; script-src-elem https://cdn.coronasafe.network https://cdn.jsdelivr.net/emojione/2.2.7/lib/js/emojione.min.js https://www.gstatic.com/ https://www.google.com/recaptcha/api.js https://sentry.io https://kit.fontawesome.com/7ef943e539.js https://static.cloudflareinsights.com 'self' ; style-src https://cdn.coronasafe.network https://cdn.jsdelivr.net/emojione/2.2.7/assets/css/emojione.min.css https://kit-free.fontawesome.com https://www.gstatic.com https://kit.fontawesome.com https://fonts.googleapis.com 'unsafe-inline' data: 'self' ;font-src https://cdn.coronasafe.network https://static-v.tawk.to https://fonts.googleapis.com https://fonts.gstatic.com https://ka-f.fontawesome.com https://kit-free.fontawesome.com data: 'self' ;img-src https://coronasafe.network https://badge.hardenize.com https://cdn.jsdelivr.net https://cdn.coronasafe.network https://a.tile.openstreetmap.org https://b.tile.openstreetmap.org https://c.tile.openstreetmap.org https://www.gstatic.com data: 'self';frame-src https://www.google.com 'self';object-src 'none';media-src 'self';connect-src https://nominatim.openstreetmap.org https://ka-f.fontawesome.com https://sentry.io https://care-patient-production.s3.amazonaws.com 'self'; frame-ancestors 'self'; manifest-src 'self' ; form-action 'self'; worker-src 'self'; base-uri 'self'; block-all-mixed-content; report-uri https://o371117.ingest.sentry.io/api/5183632/security/?sentry_key=8801155bd0b848a09de9ebf6f387ebc8 ";
       add_header X-XSS-Protection "1; mode=block";
       add_header X-Frame-Options "SAMEORIGIN";
       add_header X-Content-Type-Options nosniff;
       add_header Referrer-Policy "no-referrer, strict-origin-when-cross-origin";
       add_header Feature-Policy "geolocation 'self' ";
       add_header Powered-By "Coronasafe Network Volunteers (coronasafe.network)";
       add_header Support-Email "info@coronasafe.network";
       add_header Source-Code "github.com/coronasafe";
       add_header Licence-Type "MIT";
       add_header Slogan "Made for Kerala By Kerala";
       add_header Volunteer "volunteers.coronasafe.network";
       add_header Collaborate-On "slack.coronasafe.in";
       add_header Access-Control-Allow-Origin "'https://*.coronasafe.network' always";

        access_log /dev/stdout;
        error_log /dev/stdout;

        location /api {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
          proxy_pass http://care-django-production:9000;
        }

        location / {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
          proxy_pass http://care-fe-production-service;
        }
      }

      server {
        listen 80;
        server_name dashboard.coronasafe.network;

        if ($http_x_forwarded_proto != "https") {
          return 301 https://$host$request_uri;
        }
       add_header X-XSS-Protection "1; mode=block";
       add_header X-Frame-Options "SAMEORIGIN";
       add_header X-Content-Type-Options nosniff;
       add_header Referrer-Policy "no-referrer, strict-origin-when-cross-origin";
       add_header Feature-Policy "geolocation 'self' ";
       add_header Powered-By "Coronasafe Network Volunteers (coronasafe.network)";
       add_header Support-Email "info@coronasafe.network";
       add_header Source-Code "github.com/coronasafe";
       add_header Licence-Type "MIT";
       add_header Slogan "Made for the world By Kerala";
       add_header Volunteer "volunteers.coronasafe.network";
       add_header Collaborate-On "slack.coronasafe.in";
       add_header Access-Control-Allow-Origin "'https://*.coronasafe.network' always";
       
        access_log /dev/stdout;
        error_log /dev/stdout;

        location /api {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
          proxy_pass http://care-django-production:9000;
        }

        location / {
          proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
          proxy_set_header Host $http_host;
          proxy_redirect off;
          proxy_pass http://care-dashboard-service;
        }
      }
    }


