The issue was not within fastapi but the reverse proxy that I didn't know about. My initial code example worked and also the provided solutions here. I just had to curl /app/publish instead of /publish
/app/publish
/publish