EscolaLMS/API

View on GitHub
docker/conf/Caddyfile

Summary

Maintainability
Test Coverage
http://storage.localhost {
    reverse_proxy minio:9000
}

http://minio.localhost {
    reverse_proxy minio:9001
}

http://*.admin.localhost {
    # Resolve the root directory for the app
    root * /var/www/html/public

    # Provide Zstd and Gzip compression
    encode zstd gzip

    # Allow caddy to serve static files
    file_server

    # Enable PHP-FPM
    reverse_proxy escola_lms_admin:80

    # Cors logic 
    @origin header Origin {http.request.header.Origin}
    header @origin Access-Control-Allow-Origin {http.request.header.Origin}

    #@referer header Referer {http.request.header.Referer}
    #header @referer Access-Control-Allow-Origin {http.request.header.Referer}

    @excluded { 
        not header Origin {http.request.header.Origin}
        #not header Referer {http.request.header.Referer}
    }
    header @excluded Access-Control-Allow-Origin *
    header Access-Control-Allow-Credentials true
}

http://*.app.localhost {
    # Resolve the root directory for the app
    root * /var/www/html/public

    # Provide Zstd and Gzip compression
    encode zstd gzip

    # Allow caddy to serve static files
    file_server

    # Enable PHP-FPM
    reverse_proxy escola_lms_front:80

    # Cors logic 
    @origin header Origin {http.request.header.Origin}
    header @origin Access-Control-Allow-Origin {http.request.header.Origin}

    #@referer header Referer {http.request.header.Referer}
    #header @referer Access-Control-Allow-Origin {http.request.header.Referer}

    @excluded { 
        not header Origin {http.request.header.Origin}
        #not header Referer {http.request.header.Referer}
    }
    header @excluded Access-Control-Allow-Origin *
    header Access-Control-Allow-Credentials true
}


http://*.localhost {

    # Provide Zstd and Gzip compression
    encode zstd gzip

    # Enable PHP-FPM

    reverse_proxy api:9000 {
        header_up -Access-Control-Allow-Origin
        header_down -Access-Control-Allow-Origin
        transport fastcgi {
            env SCRIPT_FILENAME /var/www/html/index.php
        }        
    }

    # Cors logic 
    @origin header Origin {http.request.header.Origin}
    header @origin Access-Control-Allow-Origin {http.request.header.Origin}

    #@referer header Referer {http.request.header.Referer}
    #header @referer Access-Control-Allow-Origin {http.request.header.Referer}

    @excluded { 
        not header Origin {http.request.header.Origin}
        #not header Referer {http.request.header.Referer}
    }
    header @excluded Access-Control-Allow-Origin *

    header Access-Control-Allow-Credentials true

}