1. The problem I’m having:
I have a docker container with caddy which redirects traffic to an nginx container. Then nginx serves the Angular frontend will interact with the backend.
My caddy redirects requests to HTTPS for my nginx. However, the requests between nginx and my backend are in HTTP so I get the error:
“Mixed Content: The page at ‘https://srvtest.local/rack’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://srvtest.local:8000/api/oracle/ jumb/rack’.”
I would like queries made between Nginx and my backend to also be secure thanks to caddy. How to do ?
Second other small problem: caddy redirects the traffic to nginx but the https is crossed out in my browser and it tells me that the certificate is invalid. For what?
Sorry I’m starting to use caddy.
2. Error messages and/or full log output:
Mixed Content: The page at 'https://srvtest.local/rack' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://srvtest.local:8000/api/oracle/jumb/rack'.
3. Caddy version:
caddy:2.7.6
4. How I installed and ran Caddy:
a. System environment:
Docker
b. Command:
docker-compose -f docker-compose.prod.yml up
c. Service/unit/compose file:
springboot-backend_v4:
container_name: springboot-backend_v4
build:
context: ./backend
dockerfile: Dockerfile.dev.backend
volumes:
- ./backend:/app
- maven_cache:/root/.m2
ports:
- "8000:8080"
networks:
- local
depends_on:
- mssql_archiving_v4
angular-frontend_v4:
container_name: angular-frontend_v4
build:
context: ./frontend
dockerfile: Dockerfile.dev.angular
networks:
- local
depends_on:
- springboot-backend_v4
- mssql_archiving_v4
caddy_v4:
container_name: caddy_v4
build:
dockerfile: Dockerfile.prod.caddy
ports:
- "80:80"
- "443:443"
restart: unless-stopped
networks:
- local
d. My complete Caddy config:
ba071srv.cbs01dom.local {
route /* {
reverse_proxy angular-frontend_v4:8081
}
}
ba071srv.cbs01dom.local:8000 {
route /api/* {
reverse_proxy springboot-backend_v4:8080
}
}
Your help is greatly appreciated.