blob: 56f1a2957ca36cdeb1ad17f94657827d2e2afc4b [file] [log] [blame]
# *****************************************************************************
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# ******************************************************************************
location /{{ CLUSTER_NAME }}/ {
rewrite ^/{{ CLUSTER_NAME }}/{{ CLUSTER_NAME }}/(.*)$ /$1 break;
rewrite ^/{{ CLUSTER_NAME }}/(.*)$ /$1 break;
proxy_pass http://{{ MASTER_IP }}:8088;
proxy_redirect http://{{ MASTER_IP }}:8088/ $scheme://$host/{{ CLUSTER_NAME }}/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
sub_filter_types *;
sub_filter_once off;
sub_filter '/static/' '/{{ CLUSTER_NAME }}/static/';
sub_filter '/cluster/' '/{{ CLUSTER_NAME }}/cluster/';
sub_filter '/conf' '/{{ CLUSTER_NAME }}/conf';
sub_filter '/logs' '/{{ CLUSTER_NAME }}/logs';
sub_filter '/stacks' '/{{ CLUSTER_NAME }}/stacks';
sub_filter '/jmx' '/{{ CLUSTER_NAME }}/jmx';
sub_filter '//{{ MASTER_DNS }}:20888' '//$host/{{ CLUSTER_NAME }}-application';
sub_filter '//{{ MASTER_DNS }}:8088' '//$host/{{ CLUSTER_NAME }}';
{% for item in slaves %}
sub_filter '//{{ item.dns }}:8042' '//$host/{{ CLUSTER_NAME }}-{{ item.name }}';
{% endfor %}
}
location /{{ CLUSTER_NAME }}-application/ {
rewrite ^/{{ CLUSTER_NAME }}-application/(.*)$ /$1 break;
proxy_pass http://{{ MASTER_IP }}:20888;
proxy_redirect http://{{ MASTER_IP }}:20888/ $scheme://$host/{{ CLUSTER_NAME }}-application/;
proxy_http_version 1.1;
proxy_set_header Accept-Encoding "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
sub_filter_types *;
sub_filter_once off;
sub_filter '/proxy/' '/{{ CLUSTER_NAME }}-application/proxy/';
}
{% for item in slaves %}
location /{{ CLUSTER_NAME }}-{{ item.name }}/ {
rewrite ^/{{ CLUSTER_NAME }}-{{ item.name }}/(.*)$ /$1 break;
proxy_pass http://{{ item.ip }}:8042;
proxy_redirect http://{{ item.ip }}:8042/ $scheme://$host/{{ CLUSTER_NAME }}-{{ item.name }}/;
proxy_http_version 1.1;
proxy_set_header Accept-Encoding "";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
sub_filter_types *;
sub_filter_once off;
sub_filter '/static/' '/{{ CLUSTER_NAME }}-{{ item.name }}/static/';
sub_filter '/node/' '/{{ CLUSTER_NAME }}-{{ item.name }}/node/';
sub_filter '/conf' '/{{ CLUSTER_NAME }}-{{ item.name }}/conf';
sub_filter '/logs' '/{{ CLUSTER_NAME }}-{{ item.name }}/logs';
sub_filter '/stacks' '/{{ CLUSTER_NAME }}-{{ item.name }}/stacks';
sub_filter '/jmx' '/{{ CLUSTER_NAME }}-{{ item.name }}/jmx';
sub_filter '//{{ MASTER_DNS }}:8088' '//$host/{{ CLUSTER_NAME }}/';
}
{% endfor %}