CORS test for .well-known folder failed

I want to pass the CORS test of https://cors-test.codehappy.dev/ for my website for the directory https://ereignishorizont.xyz/.well-known, but I always get the response “This URL will not work correctly with CORS.”.

I have already extended the vhost.conf with this:

context /.well-known/ {
location $VH_ROOT/public_html/.well-known/
allowBrowse 1
rewrite {
enable 0
}
addDefaultCharset off
header add Access-Control-Allow-Origin “*”
header add Access-Control-Allow-Methods “GET, POST, OPTIONS”
header add Access-Control-Allow-Headers “Content-Type, Authorization”
}

I added in the Rewrite Rules:

Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET, POST, OPTIONS" Header set Access-Control-Allow-Headers "Content-Type"

I added the file .htaccess in the folder .well-known and filed it with:

Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Methods "GET, POST, OPTIONS" Header set Access-Control-Allow-Headers "Content-Type"

I restarted the server with: systemctl restart lsws

I purged with: curl -X PURGE https://ereignishorizont.xyz/.well-known/

But the https://cors-test.codehappy.dev website always gives me this error.
https://cors-test.codehappy.dev/?url=https%3A%2F%2Fereignishorizont.xyz%2F.well-known&origin=https%3A%2F%2Fcors-test.codehappy.dev%2F&method=get

Why can’t I get CORS to run for the .well-known folder? Any help?

Lol.. I had already answered this question two years ago. :grin:

This context at the end of vhost.conf is the key. :old_key:

context /.well-known {
  location                $DOC_ROOT/
  allowBrowse             1
  extraHeaders            Access-Control-Allow-Origin *
  rewrite  {
    RewriteFile           .htaccess
  }
  addDefaultCharset       off
  phpIniOverride  {
  }
}