43 lines
1.4 KiB
Text
43 lines
1.4 KiB
Text
|
error_log /dev/stdout;
|
||
|
|
||
|
lua_shared_dict jasima_cache 20m;
|
||
|
lua_package_path "/opt/sitelen-tu/?.lua;;";
|
||
|
resolver 127.0.0.11 valid=60 ipv6=off;
|
||
|
|
||
|
upstream origin {
|
||
|
server 127.0.0.1;
|
||
|
|
||
|
balancer_by_lua_file /opt/sitelen-tu/balancer.lua;
|
||
|
}
|
||
|
|
||
|
server {
|
||
|
listen 80;
|
||
|
server_name localhost default;
|
||
|
|
||
|
location / {
|
||
|
# These variables are set in the access_by_lua stage
|
||
|
# TODO: These might be better to set with a set_by_lua_block
|
||
|
set $jasima_host "fallback.invalid";
|
||
|
set $jasima_host_header "fallback.invalid";
|
||
|
set $jasima_host_ssl "fallback.invalid";
|
||
|
|
||
|
access_by_lua_file /opt/sitelen-tu/access.lua;
|
||
|
|
||
|
proxy_pass https://origin;
|
||
|
proxy_ssl_server_name on;
|
||
|
proxy_ssl_name $jasima_host_ssl;
|
||
|
proxy_set_header Accept-Encoding "";
|
||
|
proxy_set_header Host $jasima_host_header;
|
||
|
|
||
|
sub_filter_once off;
|
||
|
sub_filter_types text/html text/css text/xml application/javascript application/rss+xml application/atom+xml application/vnd.mpegurl application/x-mpegurl;
|
||
|
sub_filter 'http://$jasima_host' '/';
|
||
|
sub_filter 'https://$jasima_host' '/';
|
||
|
sub_filter '//$jasima_host' '/';
|
||
|
sub_filter 'REWRITE_JASIMA_HOST_PLACEHOLDER' $jasima_host;
|
||
|
|
||
|
header_filter_by_lua_file /opt/sitelen-tu/header_filter.lua;
|
||
|
body_filter_by_lua_file /opt/sitelen-tu/body_filter.lua;
|
||
|
}
|
||
|
}
|