generator-jhipster: Oauth2 and traefik. 404 not found
Overview of the issue
hi all, i notice a 404 page with traefik and oauth 2.
Reproduce the error
consider this jdl
jdl
application { config { baseName gateway applicationType gateway languages [fr,en] buildTool maven packageName dam.gateway serverPort 8080 authenticationType oauth2 cacheProvider hazelcast devDatabaseType postgresql prodDatabaseType postgresql //searchEngine elasticsearch serviceDiscoveryType consul enableSwaggerCodegen false testFrameworks [gatling] clientPackageManager npm nativeLanguage fr useSass true }entities *
}
application { config { baseName apis applicationType microservice skipClient true languages [fr,en] buildTool maven packageName dam.pelican serverPort 8081 authenticationType oauth2 cacheProvider hazelcast devDatabaseType postgresql prodDatabaseType postgresql //searchEngine elasticsearch serviceDiscoveryType consul enableSwaggerCodegen true testFrameworks [gatling] clientPackageManager npm nativeLanguage fr } entities * }
deployment { deploymentType docker-compose appsFolders [gateway, apis] gatewayType traefik monitoring elk consoleOptions [zipkin] serviceDiscoveryType consul dockerRepositoryName “test” }
// Domain Ressources enum RessourceState { CREATING, NOT_TESTED, READY }
entity Resources { // creator String required dateCreation Instant required dateModification Instant dateExpiration LocalDate dateAcquisiiton LocalDate dateEndOfMaintenance LocalDate state RessourceState } dto * with mapstruct paginate * with pagination service all with serviceImpl microservice * with apis
jhipster import-jdl project.jdl
next, in wepack.common.js, update baseHref to /services/gateway/.
cd gateway
./mvnw -Pprod verify jib:dockerBuild
cd ../apis
./mvnw -Pprod verify jib:dockerBuild
cd ../docker-compose
# you can disable all service in docker-compose file under traefik except keycloak
docker-compose up -d
Go to localhost/services/gateway/
in the browser log, there is an error on http://localhost/oauth2/authorization/oidc
http://localhost/oauth2/authorization/oidc
Request Method: GET
Status Code: 404 Not Found (from disk cache)
Referrer Policy: no-referrer-when-downgrade
click account > Sign in. you have a 404 page not found from traefik.
JHipster Version(s)
gatewayback@0.0.0 /home/cedric/dev/dam/test/gatewayback
└── generator-jhipster@6.0.1
Environment and Tools
openjdk version “11.0.2” 2019-01-15 OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.04.3) OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04.3, mixed mode, sharing)
git version 2.17.1
node: v10.13.0
npm: 6.4.1
Docker version 18.09.6, build 481bc77
docker-compose version 1.23.2, build 1110ad01
INFO! Congratulations, JHipster execution is complete!
Browsers and Operating System
linux ubuntu 18.04 chromium 73
- Checking this box is mandatory (this is just to show you read everything)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 15 (15 by maintainers)
yes, you are correct on this. That’s why I said some work needs to be done on spring security configurations to make login redirect works out of the box or at least correctly documented.
I confirm the issue.
I think it’s an error of redirection : it should not try to call http://localhost/oauth2/authorization/oidc but http://localhost/services/gateway/oauth2/authorization/oidc, but I didn’t manage to fix the issue yet.
It come maybe form the keycloak/oauth2 configuration, or in the way we handle the contextPath…
@antarus : to be honest, Traefik is not tested in our CI, so not sure it works well after JHipster 6. So PR are really welcome to fix this part.