Skip to content

Commit

Permalink
fixing reverse proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
delcroip committed Apr 17, 2024
1 parent e0075ea commit 2a33979
Show file tree
Hide file tree
Showing 4 changed files with 39,218 additions and 48 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ COPY --from=build-stage /app/build/ /usr/share/nginx/html
#COPY DEFAULT CERTS
COPY --from=build-stage /etc/ssl/private/ /etc/nginx/ssl/live/host

COPY conf/openimis.conf /conf/openimis.conf
COPY ./conf /conf
COPY script/entrypoint.sh /script/entrypoint.sh
RUN chmod a+x /script/entrypoint.sh
WORKDIR /script
Expand Down
56 changes: 13 additions & 43 deletions conf/openimis.conf
Original file line number Diff line number Diff line change
@@ -1,50 +1,20 @@

server {
resolver 127.0.0.11 valid=30s;
set $dockerbackend "backend:8000";
set $dockerrestapi "restapi:80";
resolver 127.0.0.11 valid=30s;

client_max_body_size ${DATA_UPLOAD_MAX_MEMORY_SIZE};
listen 443 ssl;
listen 80;
server_name ${NEW_OPENIMIS_HOST};

ssl_certificate /etc/letsencrypt/live/${NEW_OPENIMIS_HOST}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${NEW_OPENIMIS_HOST}/privkey.pem;
root /usr/share/nginx/html;
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location /.well-known {
root /var/www/html;
}
client_max_body_size ${DATA_UPLOAD_MAX_MEMORY_SIZE};
listen 443 ssl;
listen 80;
server_name ${NEW_OPENIMIS_HOST};

location / {
return 302 https://$host/${PUBLIC_URL}/${REDIRECT_TAIL};
}
ssl_certificate /etc/letsencrypt/live/${NEW_OPENIMIS_HOST}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/${NEW_OPENIMIS_HOST}/privkey.pem;
root /usr/share/nginx/html;

location /${PUBLIC_URL} {
try_files $uri $uri/ /${PUBLIC_URL}/index.html;
#error_page 404 $scheme://$host/front/;
}
location /.well-known {
root /var/www/html;
}
###INCLUDE_PLACEHOLDER###

location /${REACT_APP_API_URL}/ {
proxy_pass http://${dockerbackend};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_set_header X-Forwarded-Proto https;
}

location /${ROOT_MOBILEAPI}/ {
#this rewrite rule is required to remove "ROOT_MOBILEAPI" because implicite rule (/ at the end of the url) donc work with variable
rewrite /${ROOT_MOBILEAPI}/(.*) /$1 break;
proxy_pass http://${dockerrestapi};
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header X-Forwarded-Host $server_name;
}
}
}
4 changes: 0 additions & 4 deletions openimis.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,6 @@
"name": "DeduplicationModule",
"npm": "@openimis/fe-deduplication@git+https://github.com/openimis/openimis-fe-deduplication_js.git#develop"
},
{
"name": "GrievanceSocialProtectionModule",
"npm": "@openimis/fe-grievance_social_protection@git+https://github.com/openimis/openimis-fe-grievance_social_protection_js.git#develop"
},
{
"name": "AdminModule",
"npm": "@openimis/fe-admin@git+https://github.com/openimis/openimis-fe-admin_js.git#develop"
Expand Down
Loading

0 comments on commit 2a33979

Please sign in to comment.