Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server
- {
- server_name _ "" " ";
- listen 10.49.13.10:80 default_server bind deferred;
- root /usr/lib/unifi/;
- try_files $uri @unifi_proxy;
- set $unifi_ep [::1]:8443;
- set $unifi_uri https://$unifi_ep;
- location @unifi_proxy
- {
- proxy_pass $unifi_uri;
- proxy_redirect $unifi_uri $scheme://$server_addr;
- proxy_http_version 1.1;
- proxy_ssl_verify off;
- proxy_buffering off;
- proxy_request_buffering off;
- proxy_cache off;
- proxy_connect_timeout 5s;
- proxy_read_timeout 10s;
- proxy_send_timeout 10s;
- proxy_pass_header Set-Cookie;
- ##########################################################
- ### fix incoming HTTP Origin & Referer
- #
- set $krd_in_origin $http_origin;
- set $krd_in_referer $http_referer;
- if ($http_origin ~ '^http://10.49.13.10(.*)$') { set $krd_in_origin $unifi_uri$1; }
- if ($http_referer ~ '^http://10.49.13.10(/.+)$') { set $krd_in_referer $unifi_uri$1; }
- proxy_set_header Origin $krd_in_origin;
- proxy_set_header Referer $krd_in_referer;
- ##########################################################
- ### fix outgoing HTTP Set-Cookie
- #
- header_filter_by_lua '
- local cookies = ngx.header.set_cookie
- if not cookies then return end
- if type(cookies) == "string" then cookies = {cookies} end
- local newcookies = {}
- for i, cookie in ipairs(cookies) do
- local newcookie = string.gsub(cookie, "; [Ss]ecure", "")
- table.insert(newcookies, newcookie)
- end
- ngx.header.set_cookie = newcookies
- ';
- }
- location /manage/
- {
- alias /usr/lib/unifi/webapps/ROOT/app-unifi/;
- try_files $uri @unifi_proxy;
- include snippets/area.cdn;
- location /manage/.version { default_type text/plain; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement