From 1bf053d7c058f2ccf29c87a8cee0799f87d381b2 Mon Sep 17 00:00:00 2001
From: ncastejon <castejon.nicolas@gmail.com>
Date: Tue, 15 May 2018 13:36:07 +0200
Subject: [PATCH] Change nginx setting for wordpress proxy

---
 nginx-development.conf |  4 +++-
 nginx-staging.conf     | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/nginx-development.conf b/nginx-development.conf
index 61da272b..84370317 100644
--- a/nginx-development.conf
+++ b/nginx-development.conf
@@ -43,7 +43,9 @@ server {
     }
 
     location /wordpress/ {
-        #proxy_pass https://elastic2.recette.data.grandlyon.com/elastic/;
+        sub_filter 'http:\/\/192.168.62.15:8000\/' 'https:\/\/data-reloaded-dev.datalab.erasme.org\/wordpress\/';
+        sub_filter_once off;
+        sub_filter_types *;
         proxy_pass http://192.168.62.15:8000/;
         # proxy_set_header  X-Real-IP  $remote_addr;
         # proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
diff --git a/nginx-staging.conf b/nginx-staging.conf
index 1871ae0b..ddabb09b 100644
--- a/nginx-staging.conf
+++ b/nginx-staging.conf
@@ -42,4 +42,21 @@ server {
         add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
     }
 
+    location /wordpress/ {
+        #proxy_pass https://elastic2.recette.data.grandlyon.com/elastic/;
+        sub_filter 'http:\/\/192.168.62.15:8000\/' 'https:\/\/data-reloaded-rec.datalab.erasme.org\/wordpress\/';
+        sub_filter_once off;
+        sub_filter_types *;
+        proxy_pass http://192.168.62.15:8000/;
+        # proxy_set_header  X-Real-IP  $remote_addr;
+        # proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
+        #proxy_set_header Host $http_host;
+        # proxy_set_header  Host elastic.datalab.erasme.org;
+        # add_header 'Access-Control-Allow-Origin' '*';
+        # add_header 'Access-Control-Allow-Credentials' 'true';
+        # add_header 'Access-Control-Allow-Methods' 'GET, OPTIONS';
+        # add_header 'Access-Control-Allow-Headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
+    }
+
+
 }
-- 
GitLab