
User15857131905347322946 (Customer) asked a question.
Hello,
I've developed a web application based on the tutorial in the link below, which used okta for the login:
https://developer.okta.com/blog/2018/07/19/simple-crud-react-and-spring-boot
This worked great until I deployed it into docker. When run from a container, the login api call is apparently going directly to the spring boot app instead of getting redirected to okta.
The reason I say this is spring is returning the default "White Label Error Page" when I try to log in, and the url displayed in the browser is "http://localhost:8080/private".
This must come for the following code in the React front end:
login() {
let port = (window.location.port ? ':' + window.location.port : '');
if (port === ':3000') {
port = ':8080';
}
window.location.href = '//' + window.location.hostname + port + '/private';
}
Any ideas on why this wouldn't work from inside a docker container? I'm a newbie to Docker, so I'm not sure what setup needs to be done in this situation.
Here's the docker-compose.yml
version: "3"
services:
* Backend Service
app-server:
image: licensing-app
ports:
- "8080:8080"
networks:
- backend
depends_on:
- mysqldb
* Frontend Service
app-client:
image: license_front_end
ports:
- "3000:80" * Map the exposed port 80 on the container to port 3000 on the host machine
restart: always
depends_on:
- app-server
networks:
- backend
* Database Service (Mysql)
mysqldb:
image: mysql:8
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: mypassword
MYSQL_DATABASE: license_db
volumes:
- db-data:/var/lib/mysql
networks:
- backend
* Volumes
volumes:
db-data:
* Networks to be created to facilitate communication between containers
networks:
backend:
Thanks in advance for any help or suggestions.

Some additional info - per this link:
spring.security.oauth2.client.registration.okta.client-id
I've added three environment variables (with the "xxx'" replaced with my credentials) to the yml, but still no luck. The relevant section is shown below:
app-server:
image: licensing-app
ports:
- "8080:8080"
networks:
- backend
depends_on:
- mysqldb
environment:
- OKTA_OAUTH2_ISSUER=https://dev-xxxxxx.okta.com/oauth2/default
- OKTA_OAUTH2_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxx
- OKTA_OAUTH2_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx