⇦ Back to Post Listing

Basic Caddyfile to run an exported GodotXR game.

I only have a Quest 2 for testing, because sometimes exporting for android and sideloading onto the quest can be a pain, so I'd like to use WebXR to output projects and hopefully speed up the development cycle. And have things be more flexible. But a Godot web export needs to have certain cross-origin settings to properly work, and the Quest browser requires SSL to view non-local web projects, which makes things a little trickier. The below Caddyfile will fix those problems.

{                                                                                                                                        
        http_port 7999                                                                                                                   
}                                                                                                                                        
                                                                                                                                         
https://:8000                                                                                                                            
                                                                                                                                         
file_server browse                                                                                                                       
                                                                                                                                         
tls internal {                                                                                                                           
        on_demand                                                                                                                        
}                                                                                                                                        
                                                                                                                                         
header {                                                                                                                                 
        Strict-Transport-Security: "max-age=31536000; preload"                                                                           
        X-Content-Type-Options: "nosniff"                                                                                                
        X-Frame-Options: "DENY"                                                                                                          
        X-XSS-Protection: "1; mode=block"                                                                                                
        Referrer-Policy: "strict-origin-when-cross-origin"                                                                               
        Cross-Origin-Embedder-Policy: "require-corp"                                                                                     
        Cross-Origin-Opener-Policy: "same-origin"                                                                                        
        Etag                                                                                                                             
        cache-control: public, max-age=3600                                                                                              
}  

Just put the above in a Caddyfile in the same directory as your Godot export and you're all set to go! The server lives on port 8000, and the entrypoint should be named index.html