I have a Linux Server. On that I have two Docker Containers.In the first one I am deploying my Flutter Web and in the other one I am running my RestAPI with FastAPI().
I set both the Docker containers in the same Network, so the communication should work. I also set origins with origins = ['*']
(Wildcard). I reverse proxy my Flutter web with nginx
from the Linux server. I also include *.crt
and *.key
with nginx to my Flutter Web.
Now, obviously, since my Flutter Web App has https
, I cant make http
calls. When I am trying to make a call with https
, I get the Error (from catch): "XMLHttpRequest error"
, and in the Browser Console I get:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://172.21.0.2:8070/. (Reason: CORS request did not succeed). Status code: (null).
(172.21.0.2 is the ip of the Docker and 8070 the port on RestApi running)
I am new to the RestAPI world. I normaly develop only Frontend. But I wanted to give it a try. So I'm sorry if I expressed some things wrong. I am searching since days but cant find a solution to my problem. I would be grateful for any help! (If i missed some information or you need more, feel free to write in the comments, I will update the Question immediately!)
Thank You!