Skip to content

Instantly share code, notes, and snippets.

@thanhpk
Created September 26, 2018 18:19
Show Gist options
  • Save thanhpk/08a819690bb17fb2e39dc70fa8c2ec6d to your computer and use it in GitHub Desktop.
Save thanhpk/08a819690bb17fb2e39dc70fa8c2ec6d to your computer and use it in GitHub Desktop.
nginx
server {
listen 80;
server_name ~^...\-app\.subiz\.net$ app.subiz.net app.subiz.com;
keepalive_timeout 60;
proxy_max_temp_file_size 0;
access_log /var/log/nginx/dashboard_access.log main;
error_log /var/log/nginx/dashboard_error.log warn;
underscores_in_headers on;
location ~ /v4/(.*) {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass_request_headers on;
set $backend_servers1 dashboard.default.svc.cluster.local;
proxy_pass http://$backend_servers1:80/v4/$1$is_args$args;
}
location ~ /api/(.*) {
proxy_set_header Host $host;
proxy_pass_request_headers on;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Access-Token $cookie_accesstoken;
set $backend_servers2 api.default.svc.cluster.local;
proxy_pass http://$backend_servers2:80/$1$is_args$args;
}
location ~ /oauth/(.*) {
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_pass_request_headers on;
set $backend_servers3 auth.default.svc.cluster.local;
proxy_pass http://$backend_servers3:80/oauth/$1$is_args$args;
}
location ~ /mailkon/(.*) {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass_request_headers on;
set $backend_servers4 mailkon.default.svc.cluster.local;
proxy_pass http://$backend_servers4:80/$1$is_args$args;
}
location ~ /fabikon/(.*) {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass_request_headers on;
set $backend_servers5 fabikon.default.svc.cluster.local;
proxy_pass http://$backend_servers5:80/$1$is_args$args;
}
location ~ /GNIP123(.*) {
return 200 'great!-dashboard is proxied';
}
location ~ /(.*) {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass_request_headers on;
set $backend_servers dashboard.default.svc.cluster.local;
proxy_pass http://$backend_servers:80/ui/$1$is_args$args;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
server_tokens off;
location ~ /\.(ht|svn|git) {
deny all;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment