diff --git a/templates/entrypoint.sh b/templates/entrypoint.sh index e533d26..ac8bce6 100644 --- a/templates/entrypoint.sh +++ b/templates/entrypoint.sh @@ -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; diff --git a/templates/nginx/configs/default.conf b/templates/nginx/configs/default.conf index 43eff1e..0e74fe6 100644 --- a/templates/nginx/configs/default.conf +++ b/templates/nginx/configs/default.conf @@ -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;