Skip to content
Snippets Groups Projects
Select Git revision
  • 21d189b2b096dee487a7187b1551d4748623127e
  • dev default protected
  • 728-cartographie-ordre-d-affichage-de-la-liste
  • master protected
  • 723-structures-l-api-ne-prend-pas-en-compte-l-offre-des-mediateurs
  • renovate/major-storybook-monorepo
  • renovate/ngx-toastr-19.x
  • renovate/ngx-matomo-client-8.x
  • renovate/bluehalo-ngx-leaflet-20.x
  • renovate/major-angularmaterial-monorepo
  • renovate/major-angular-monorepo
  • renovate/major-ag-grid-monorepo
  • renovate/major-typescript-eslint-monorepo
  • renovate/npm-11.x
  • renovate/ng-packagr-20.x
  • renovate/chromatic-com-storybook-4.x
  • renovate/major-angular-eslint-monorepo
  • renovate/major-angular-cli-monorepo
  • renovate/leaflet.locatecontrol-0.x
  • renovate/devdependencies-(non-major)
  • renovate/chokidar-4.x
  • v4.1.1
  • v4.1.0
  • v4.0.2
  • v4.0.1
  • v4.0.0
  • v3.4.3
  • v3.4.2
  • v3.4.1
  • v3.4.0
  • v3.3.1
  • v3.3.0
  • v3.2.2
  • v3.2.1
  • v3.2.0
  • v3.1.0-openshift
  • v3.1.0
  • v3.0.2
  • v3.0.1
  • v3.0.0
  • v2.5.0
41 results

default.conf.template

Blame
  • default.conf.template 4.18 KiB
    map $http_user_agent $outdated {
      default                                 0;
      "~MSIE [1-10]\."                        1;
      "~Trident/[5-7]\."                      1;
      "~Mozilla.*Firefox/[1-9]\."             1;
      "~Mozilla.*Firefox/[0-2][0-9]\."        1;
      "~Mozilla.*Firefox/3[0-1]\."            1;
      "~Opera.*Version/[0-9]\."               1;
      "~Opera.*Version/[0-1][0-9]\."          1;
      "~Opera.*Version/2[0-1]\."              1;
      "~AppleWebKit.*Version/[0-6]\..*Safari" 1;
      "~Chrome/[0-9]\."                       1;
      "~Chrome/[0-2][0-9]\."                  1;
      "~Chrome/3[0-3]\."                      1;
    }
    
    map $http_user_agent $prerender {
      default                                 0;
      "~*twitterbot"                          1;
      "~*facebookexternalhit"                 1;
      "~*linkedinbot"                         1;
      "~*instagram"                           1;
      "~*discordbot"                          1;
    }
    
    map $time_iso8601 $year {
        default '0000';
        "~^(\d{4})-(\d{2})-(\d{2})" $1;
    }
    map $time_iso8601 $month {
        default '00';
        "~^(\d{4})-(\d{2})-(\d{2})" $2;
    }
    map $time_iso8601 $day {
        default '00';
        "~^(\d{4})-(\d{2})-(\d{2})" $3;
    }
    
    server {
      listen 8080 default_server;
    
      root /usr/share/nginx/html/;
    
      server_tokens off;
    
      ## get the calling real ip behind the haproxy ( https://nginx.org/en/docs/http/ngx_http_realip_module.html )
      set_real_ip_from 10.131.2.2;
      set_real_ip_from 10.4.75.2;
      real_ip_header X-Forwarded-For;
      ##real_ip_recursive on;
      #allow x.y.z.w;
      #deny all;
    
      location /data-grandlyon-cities {
        proxy_pass https://data.grandlyon.com/fr/datapusher/ws/grandlyon/adr_voie_lieu.adrcomgl/all.json;
      }
    
      # Persist logs for jeuAieAieIA
      location /shared/jeuAieAieIA {
        # Default log which is redirected to stdout (must be reset in this block because of "access_log" below)
        access_log  /var/log/nginx/access.log  main;
        # And also write to a daily file
        access_log /usr/share/nginx/html/shared/jeuAieAieIA/stats/log/access.$year-$month-$day.log  main;
      }
    
      location / {
        add_header X-Frame-Options SAMEORIGIN always;
        add_header X-Content-Type-Options nosniff;
    
        # Redirect outdated navigator
        if ($outdated = 1){
          rewrite ^ /outdated.html break;
        }
    
        # Prerender with og tags for publications on linkedin and other social networks (news post, etc.)
        # Never prerender static files existing on server (images, etc.)
        if (-f $request_filename) {
            set $prerender 0;
        }
        # resolver is needed by nginx to resolve proxy_pass url with variable (https://stackoverflow.com/questions/57937222/502-bad-gateway-nginx-no-resolver-defined-to-resolve )
        resolver  dns-default.openshift-dns.svc.cluster.local;
        if ($prerender = 1) {
            # Add $request_uri to avoid error nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except"
            # (proxy_pass in if clause is not recommanded, but don't kwnow other way in our case to redirect to a backend ; cf. https://www.f5.com/fr_fr/company/blog/nginx/avoiding-top-10-nginx-configuration-mistakes#if , https://stackoverflow.com/a/10634915 )
          proxy_pass http://res-server-service.ns-res-${NAMESPACE_ENV}-syn.svc.cluster.local:3000/api/render$request_uri;
        }
    
        # Angular routed apps first attempt to serve request as file, then as directory
        # then must fall back to index.html ( https://angular.io/guide/deployment#server-configuration )
        try_files $uri $uri/ /index.html;
      }
     
      location /api {
        proxy_pass http://res-server-service:3000;
      }
    
      location /base-adresse/base-adresse-nationale/streets {
        proxy_pass https://passerelle.formulaireextranet.grandlyon.com/base-adresse/base-adresse-nationale/streets;
      }
      
      location /geocoding/photon/api {
        proxy_pass https://download.data.grandlyon.com/geocoding/photon/api;
      }
      
      location /reverse {
        proxy_pass https://api-adresse.data.gouv.fr/reverse;
      }
    
      location /wfs/grandlyon {
        proxy_pass https://download.data.grandlyon.com/wfs/grandlyon;
      }
    
      # REALLY important for JavaScript modules (type="module") to work as expected!!!
      location ~ \.js {
        add_header  Content-Type   text/javascript;
      }
    
    }