### Proxy Forward to local running "radicale" server
###
### Usual configuration file location: /etc/nginx/default.d/

## "well-known" redirect at least for Apple devices
rewrite ^/.well-known/carddav /radicale/ redirect;
rewrite ^/.well-known/caldav /radicale/ redirect;

## Base URI: /radicale/
location /radicale/ {
    proxy_pass        http://localhost:5232/;
    proxy_set_header  X-Script-Name /radicale;
    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header  X-Forwarded-Host $host;
    proxy_set_header  X-Forwarded-Port $server_port;
    proxy_set_header  X-Forwarded-Proto $scheme;
    proxy_set_header  Host $http_host;
    proxy_pass_header Authorization;
}

## Base URI: /
#location / {
#    proxy_pass        http://localhost:5232/;
#    proxy_set_header  X-Script-Name /radicale;
#    proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
#    proxy_set_header  X-Forwarded-Host $host;
#    proxy_set_header  X-Forwarded-Port $server_port;
#    proxy_set_header  X-Forwarded-Proto $scheme;
#    proxy_set_header  Host $http_host;
#    proxy_pass_header Authorization;
#}
