Skip to content

Commit

Permalink
Proxy pass to SWAG
Browse files Browse the repository at this point in the history
  • Loading branch information
ikennaokpala committed Nov 10, 2016
1 parent 4f943f1 commit 13c609f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ sudo cp ${USER_TEMPLATES_PATH}/enabled/*.conf ${NGINX_USER_CONF_PATH}/enabled;
sudo cp ${USER_TEMPLATES_PATH}/conf/*.conf ${NGINX_CONF_PATH};
sudo cp ${USER_TEMPLATES_PATH}/lua/*.conf ${NGINX_USER_CONF_PATH}/lua;

for name in NGINX_USER NGINX_PATH_PREFIX SERVER_URLS MY_USER GFB_PIPED_DOMAINS LUA_ROOT_PATH LUAJIT_ROOT LUA_MAIN_VERSION SSL_ROOT NGINX_USER_CONF_PATH NGINX_CONF_PATH NGINX_LOG_PATH NGINX_USER_LOG_PATH VARNISH_PORT_80_TCP_ADDR VARNISH_PORT_80_TCP_PORT LUAJIT_PACKAGE_PATH
for name in NGINX_USER NGINX_PATH_PREFIX SERVER_URLS MY_USER GFB_PIPED_DOMAINS LUA_ROOT_PATH LUAJIT_ROOT LUA_MAIN_VERSION SSL_ROOT NGINX_USER_CONF_PATH NGINX_CONF_PATH NGINX_LOG_PATH NGINX_USER_LOG_PATH VARNISH_PORT_80_TCP_ADDR VARNISH_PORT_80_TCP_PORT SWAG_PORT_80_TCP_ADDR SWAG_PORT_80_TCP_PORT LUAJIT_PACKAGE_PATH
do
eval value=\$$name;
sudo sed -i "s|\${${name}}|${value}|g" ${NGINX_CONF_PATH}/nginx.conf;
Expand Down
10 changes: 9 additions & 1 deletion templates/nginx/configs/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ expires 30d;

location / {
include ${NGINX_USER_CONF_PATH}/configs/scheme.conf;
proxy_pass http://${VARNISH_PORT_80_TCP_ADDR}:${VARNISH_PORT_80_TCP_PORT};

if ($host ~* ^api\.globalfoodbook\.) {
proxy_pass http://${SWAG_PORT_80_TCP_ADDR}:${SWAG_PORT_80_TCP_PORT};
}

if ($host !~* ^api\.globalfoodbook\.) {
proxy_pass http://${VARNISH_PORT_80_TCP_ADDR}:${VARNISH_PORT_80_TCP_PORT};
}

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;
Expand Down

0 comments on commit 13c609f

Please sign in to comment.