1. Countermeasures
Issue: Not localhost
# Frontend server with Next.js
next dev
# Backend server with FastAPI and uvicorn
uvicorn app:app --reload
Solution: Explicitly specify IP address.
# Frontend server with Next.js
next dev -H 192.168.11.2
# Backend server with FastAPI and uvicorn
uvicorn app:app --reload --host 192.168.11.2
It's necessary to explicitly specify the IP address for both.
2. Background
- Trying to check the screen from a smartphone by connecting to the development server 192.168.11.2
- The images stored on the backend server are not displayed
- Change the URL of the backend server accessed by the Next.js frontend server from localhost to 192.168.11.2
- An error occurs with
fetch
3. Cause
Not very clear.