For enabling cors on my server and to resolve XMLHttpRequest error in flutter web
I am using this in my .htaccess
file for allowing access to certain domains only
<ifModule mod_headers.c>
SetEnvIf Origin "http(s)?://(localhost:25120|domain.com|domain2.com)$" AccessControlAllowOrigin=$0
Header add Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
Header always set Access-Control-Allow-Methods: "GET,POST,OPTIONS,DELETE,PUT"
</ifModule>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…