User Tools

Site Tools


directadmin:nginx-cors

DirectAdmin enable CORS on nginx

To enable CORS for domains, open You DirectAdmin CutomHTTPD editor:

https://SERVER:2222/CMD_CUSTOM_HTTPD?domain=DOMAIN.TLD&proxy=yes

To CUSTOM2 section add:

    # Simple requests
    if ($request_method ~* "(GET|POST)") {
      add_header "Access-Control-Allow-Origin"  *;
    }
 
    # Preflighted requests
    if ($request_method = OPTIONS ) {
      add_header "Access-Control-Allow-Origin"  *;
      add_header "Access-Control-Allow-Methods" "GET, POST, OPTIONS, HEAD";
      add_header "Access-Control-Allow-Headers" "Authorization, Origin, X-Requested-With, Content-Type, Accept";
      return 200;
    }
directadmin/nginx-cors.txt · Last modified: 2018/05/14 09:55 by dreiggy

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki