Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

configuring https inside Docker with nginx and Cloudflare origin certificate and force carto api url to be https #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@ services:
networks:
- default
- weblan
web:
build:
context: ./
dockerfile: web.dockerfile
working_dir: /home/node/app
volumes:
- ./:/home/node/app
- ./origin.pem:/origin.pem
- ./origin.key:/origin.key
ports:
- "443:443"
- "80:80"
depends_on:
- "app"
networks:
- weblan
networks:
weblan:
external:
Expand Down
4 changes: 2 additions & 2 deletions src/app/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ module.exports = function(app) {
}],
options: {
tooltip: true
}
})
},
},{https: true})
.addTo(map)
.done(function(layer) {

Expand Down
40 changes: 40 additions & 0 deletions vhost.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#server {
# listen 80;
# listen [::]:80;
# server_name teste-visaguas.infoamazonia.org;
# return 302 https://$server_name$request_uri;
#}


server {

# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
#server_name teste-visaguas.infoamazonia.org;

ssl on;
ssl_certificate /origin.pem;
ssl_certificate_key /origin.key;

location / {
root /home/node/app/dist;
try_files $uri /index.html;
}

location /api {

# This would be the directory where your React app's static files are stored at
#root /home/node/app/dist;
#try_files $uri /index.html;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://app:3000/api;
proxy_ssl_session_reuse off;
proxy_set_header Host $http_host;
proxy_cache_bypass $http_upgrade;
proxy_redirect off;
}

}
3 changes: 3 additions & 0 deletions web.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM nginx:1.10

ADD vhost.conf /etc/nginx/conf.d/default.conf