docker-nginx-webdav icon indicating copy to clipboard operation
docker-nginx-webdav copied to clipboard

enable cors in nginx

Open madcoda9000 opened this issue 1 year ago • 0 comments

Hello,

the webdav server is working like a charm. But it would be very helpful if the nginx webserver is configured with cors enabled. This is neccessary for static js/html apps. For example keeweb.

Maybe you can provide a ev parameter for allowed hosts that then is repected by the cors settings of nginx. Example:

ALLOWED_HOSTS = "https://www.host1.de, http://hopst2.de"

Cors in nginx can be enabled like this for example:

To allow access from ALL websites:

server{
   ...
   add_header Access-Control-Allow-Origin *;
   ...
}

To allow access from multiple domains:

server {
  ...
  add_header Access-Control-Allow-Origin "example1.com";
  add_header Access-Control-Allow-Origin "example2.com";
  add_header Access-Control-Allow-Origin "example3.com";
  ...
}

madcoda9000 avatar Nov 16 '24 12:11 madcoda9000