Skip to content
Snippets Groups Projects
dev.conf 2.33 KiB
Newer Older
Hugo SUBTIL's avatar
Hugo SUBTIL committed
upstream api_node_js {
	server	service-ram:3000;
}

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;
}

server {
  listen 8080 default_server;

  root /usr/share/nginx/html/;
  set $matomo_script
  "<script type='text/javascript'>
    var _paq = window._paq = window._paq || [];
    _paq.push(['trackPageView']);
    _paq.push(['enableLinkTracking']);
    (function() {
      var u='<URL_GDLYON>';
      _paq.push(['setTrackerUrl', u+'piwik.php']);
      _paq.push(['setSiteId', '<SITE_ID>']);
      var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
      g.type='text/javascript'; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
    })();
  </script>";

  location / {
    # Redirect outdated nav
    if ($outdated = 1){
      rewrite ^ /outdated.html break;
    }
    # First attempt to serve request as file, then
    # as directory, then fall back to displaying a 404.
    try_files $uri $uri/ /index.html;
    sub_filter '</head>' '$matomo_script</head>';
  location /api {
    proxy_pass http://service-ram:3000;
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  }
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  location /base-adresse/base-adresse-nationale/streets {
Hugo SUBTIL's avatar
Hugo SUBTIL committed
    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;
Hugo SUBTIL's avatar
Hugo SUBTIL committed
  }
Hugo SUBTIL's avatar
Hugo SUBTIL committed

  location /reverse {
Hugo SUBTIL's avatar
Hugo SUBTIL committed
    proxy_pass https://api-adresse.data.gouv.fr/reverse;
  }

  location /wfs/grandlyon {
    proxy_pass https://download.data.grandlyon.com/wfs/grandlyon;
  }
  location ~* (/ghost) {
    expires epoch;
    proxy_no_cache 1;
    proxy_pass http://ghost:2368;
  }

Hugo SUBTIL's avatar
Hugo SUBTIL committed
  # REALLY important for JavaScript modules (type="module") to work as expected!!!
  location ~ \.js {
    add_header  Content-Type   text/javascript;
  }