this error occured.
Environment : docker-compose, vue, spring, mysql, redis
docker works on oracle cloud server. because i deployed.
docker-compose.yml
version: '3.8'
services:
app-mysql:
image: mysql:8.0
environment:
MYSQL_ROOT_PASSWORD: 1234 <---example
MYSQL_DATABASE: data
volumes:
- ./db/mysql/data:/var/lib/mysql
ports:
- '3306:3306'
networks:
- app-network
restart: always
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 30s
retries: 10
redis:
container_name: redis
image: redis:latest
ports:
- '6380:6380'
networks:
- app-network
vue:
container_name: front
image: frontimage
environment:
VITE_API_URL: http://spring:8088/
ports:
- '80:80'
- '443:443'
restart: always
networks:
- app-network
spring:
container_name: spring
image: backimage
ports:
- '8088:8088'
environment:
DB_PASSWORD: 1234
DB_USER: root
DB_URL: jdbc:mysql://app-mysql:3306/data?useSSL=false&allowPublicKeyRetrieval=true
JWT_SECRET: 1d5b94681dec98b3623a7827a489076cd2e28065d110034c27c17b360a39ae5d
REDIS_HOST: redis
depends_on:
- app-mysql
- redis
restart: always
networks:
- app-network
networks:
app-network:
driver: bridge
default.conf
server {
listen 80;
server_name viewgorithm.site;
location / {
root /usr/share/nginx/html;
index index.html;
try_files $uri $uri/ /index.html;
}
location /user {
proxy_pass http://spring:8088;
}
location /algorithm {
proxy_pass http://spring:8088;
}
location /user/post {
proxy_pass http://spring:8088;
}
location /logout {
proxy_pass http://spring:8088;
}
}
.env
VITE_BASE_URL:http://spring:8088/
i changed docker network.
bridge -> host
but it’s not working.
And spring project is no problem.
i think cors is fine.
.cors(c -> {
CorsConfigurationSource source = request -> {
var cors = new CorsConfiguration();
cors.addAllowedOriginPattern("*");
cors.setAllowedMethods(List.of("*"));
cors.setAllowedHeaders(List.of("*"));
cors.setAllowCredentials(false);
cors.setMaxAge(3600L);
return cors;
};
c.configurationSource(source);
}
)
Previously, I accessed it with an ip address and there was no problem. However, after applying the domain, it says that it is not possible to communicate with the spring container.
Jin is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.