My flutter app works well on android and iOS. Now I am trying to publish my app also on web (Domain: webapp.ockenheim.de).
But every GET Request of data from https://app.ockenheim.de was blocked by CORS.
Then I added header( "Access-Control-Allow-Origin: https://webapp.ockennheim.de" ); to function.php of my template.
I also tried adding
header( "Access-Control-Allow-Origin: *" );
Now I can make CORS requests to custom REST API endpoints. Only the "Network Image" requests of Flutter App are blocked now:
Cross-Origin request blocked: The same origin rule block reading https://app.ockenheim.de/wp-content/uploads/2022/12/Screenshot_20221202_121659-1.jpg. (reason: CORS-header 'Access-Control-Allow-Origin' is missing). Statuscode: 200.
The code which loads the image from flutter:
Container(
              constraints: const BoxConstraints(
                maxHeight: double.infinity,
                maxWidth: double.infinity,
              ),
              width: 10000,
              //height: double.infinity,
              margin: const EdgeInsets.fromLTRB(0, 0, 0, 0),
              padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
              //height: 170,
              decoration: BoxDecoration(
                  image: DecorationImage(
                fit: BoxFit.cover,
                image: NetworkImage(cardModell.bild),
              )),
Does someone have a clue, how to solve this issue?
 
    