server {
    listen %%interface%%:%%port%% default_server;
    include /etc/nginx/includes/server_params.conf;
    include /etc/nginx/includes/proxy_params.conf;
    client_max_body_size 0;
    server_name photoprism.*;

    add_header 'Referrer-Policy' 'no-referrer';
    proxy_set_header Range $http_range; 
    proxy_set_header If-Range $http_if_range;

    location / {
       # Proxy
       proxy_pass http://127.0.0.1:2341%%ingress_entry%%/;

       proxy_read_timeout 300;
       proxy_redirect           off;
       proxy_buffering off;                                                    # Do not hold back the request while the client sends data, give the stream directly to PP
       proxy_set_header         X-Real-IP $remote_addr;                        # Let PP know the clients real IP
       proxy_set_header         X-Forwarded-For $proxy_add_x_forwarded_for;    # Let PP know that a proxy did forward this request
       proxy_set_header         Host $http_host;                               # Set Proxy host info

       # Websockets
       proxy_http_version 1.1;                                                 # Required for WebSocket connection
       proxy_set_header Upgrade $http_upgrade;                                 # Allow protocol switch to websocket
       proxy_set_header Connection "Upgrade";                                  # Do protocol switch
       proxy_set_header X-Forwarded-Proto $scheme;                             # Let PP know that this connection used HTTP or HTTPS

       # Allow frames
       proxy_hide_header        'x-frame-options';                             # Allow frames
       proxy_hide_header        "Content-Security-Policy";
       add_header               Access-Control-Allow-Origin *;
       proxy_set_header         Accept-Encoding "";
      
    }
}

