generator-jhipster icon indicating copy to clipboard operation
generator-jhipster copied to clipboard

OIDC proxy error on port 9000 or 4200, when using infinispan caching, yet it works when not proxying on port 8080

Open naris opened this issue 1 year ago • 12 comments

Overview of the issue

When using an external OIDC provider (keycloak) running a newly generated jhipster app, after setting the issuer-uri to the keycloak server, the application works if you go directly to the app on port 8080 but if you use the proxy on port 9000, or 4200, it errors out with "Error occurred while trying to proxy: localhost:9000/oauth2/authorization/oidc"

I have this issue with my existing project, which is where I encountered it after upgrading to jhipster 8.x, but it also happens with a newly generated project. This worked before when using jhipster 7.x

Motivation for or Use Case

To be able to use the BrowserStack proxy/HMR. I am able to work around the issue by going directly to port 8080 and not running npm start, but that is not how one is supposed to develop a jhipster app :(

Reproduce the error
  1. Generate a jhipster application using oauth2/openapi authentication, you can either use the .yo-rc.json in this issue or generate a new application by answering the jhipster questions, specifying oauth2/oidc authentication.
  2. set up or use an existing non-local keycloak provider on a different machine
  3. set security:oauth2:client:provider:oidc:issuer-uri: https://<external_server>/realms/<realm_to_use> in application.yml
  4. comment out or remove offline_access from security:oauth2:client:provider:registration:oidc:scope in application.yml
  5. start the application itself with ./mvnw
  6. go to the application's port (localhost:8080) and click sign-in, this will work
  7. start the BrowserStack proxy by running npm start (which also automagically goes to localhost:9000 in your browser)
  8. go to the proxied port (localhost:9000), if not already there, and click sign-in, this will not work and show "Error occurred while trying to proxy: localhost:9000/oauth2/authorization/oidc"
Related issues
Suggest a Fix
JHipster Version(s)

8.3.0 & 8.5.0

JHipster configuration
.yo-rc.json file
{
  "generator-jhipster": {
    "applicationType": "monolith",
    "authenticationType": "oauth2",
    "baseName": "TotalFact",
    "buildTool": "maven",
    "cacheProvider": "infinispan",
    "clientFramework": "angular",
    "clientTestFrameworks": [
      "cypress"
    ],
    "clientTheme": "none",
    "creationTimestamp": 1712780550560,
    "cypressAudit": true,
    "cypressCoverage": true,
    "databaseType": "sql",
    "devDatabaseType": "oracle",
    "devServerPort": 4200,
    "enableHibernateCache": true,
    "enableSwaggerCodegen": true,
    "enableTranslation": true,
    "entities": [
      "Attribute",
      "Category",
      "Derivation",
      "Dimension",
      "EpsilonDataSource",
      "FieldValue",
      "Platform",
      "PlatformDE",
      "PlatformInst",
      "PlatformList",
      "PlatformType",
      "PrivateNotes",
      "Product",
      "ProtectedClass",
      "Release",
      "Royalty",
      "Section",
      "SourceType",
      "Step",
      "Task",
      "Universe",
      "UPC",
      "UPCRule",
      "Usage"
    ],
    "feignClient": null,
    "jhipsterVersion": "8.3.0",
    "languages": [
      "en"
    ],
    "lastLiquibaseTimestamp": 1715294100000,
    "messageBroker": false,
    "microfrontend": null,
    "microfrontends": [],
    "nativeLanguage": "en",
    "packageName": "com.epsilon.totalfact",
    "prodDatabaseType": "oracle",
    "reactive": false,
    "searchEngine": false,
    "serverPort": null,
    "serverSideOptions": [
      "enableSwaggerCodegen:true"
    ],
    "serviceDiscoveryType": false,
    "skipCheckLengthOfIdentifier": true,
    "skipUserManagement": true,
    "syncUserWithIdp": false,
    "testFrameworks": [
      "gatling",
      "cypress"
    ],
    "websocket": false,
    "withAdminUi": true
  }
}
Environment and Tools

openjdk version "17.0.6" 2023-01-17 LTS OpenJDK Runtime Environment Microsoft-7209853 (build 17.0.6+10-LTS) OpenJDK 64-Bit Server VM Microsoft-7209853 (build 17.0.6+10-LTS, mixed mode, sharing)

git version 2.40.1.windows.1

node: v18.20.1 npm: 10.5.0

'docker' command could not be found

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory
JDL entity definitions
@ChangelogDate("20240509223437")
@Filter
@Paginate("pagination")
entity Attribute {
  fieldLevel String maxlength(128)
  createUser String required
  createDate Instant required
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223438")
@Filter
@Paginate("pagination")
entity Category {
  name String maxlength(128) required
  createUser String required
  createDate Instant required
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223439")
@Filter
@Paginate("pagination")
entity Derivation {
  code String maxlength(10) required
  name String maxlength(128)
  description String maxlength(1024)
}
@ChangelogDate("20240509223440")
@Filter
@Paginate("pagination")
entity Dimension {
  name String maxlength(128) required
  description String
  createUser String required
  createDate Instant required
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223441")
@Filter
@Paginate("pagination")
entity EpsilonDataSource {
  name String maxlength(128)
}
@ChangelogDate("20240509223442")
@Filter
@Paginate("pagination")
entity FieldValue {
  fieldValue String maxlength(25) required
  valueDefinition String
  averageMatchRate Float min(0) max(100)
  displayOrder Integer
  activeFlag Boolean
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223443")
@Filter
@Paginate("pagination")
entity Platform {
  primarySymbol String maxlength(128) required
  fieldName String maxlength(250) required
  fieldDescription String maxlength(1024)
  fieldLength Integer
  fieldValue String maxlength(100)
  shortHeaderName String maxlength(10)
  longHeaderName String maxlength(200)
  inUse Boolean
  premiumField Boolean
  approvalRequired Boolean
  royalty Boolean
  token String maxlength(50)
  sasKey String maxlength(10)
  rateId String maxlength(10)
  countType String maxlength(1)
  kvp String maxlength(50)
  caseable Boolean
  sanRequired Boolean
  waiverRequired Boolean
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223444")
@Filter
@Paginate("pagination")
entity PlatformDE (platform_de) {
  ecapsKey Integer
  defaultValue String maxlength(10)
  usedInBilling Boolean
  displayZeroCounts Boolean
  areaFillinRequired Boolean
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223445")
@Filter
@Paginate("pagination")
entity PlatformInst {
  pricingFlag Boolean
  selectFlag Boolean
  outputFlag Boolean
  crosstabFlag Boolean
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223446")
@Filter
@Paginate("pagination")
entity PlatformList {
  pricingFlag Boolean
  selectFlag Boolean
  outputFlag Boolean
  crosstabFlag Boolean
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223447")
@Filter
@Paginate("pagination")
entity PlatformType {
  name String maxlength(10) required
  description String
}
@ChangelogDate("20240509223448")
@Filter
@Paginate("pagination")
entity PrivateNotes {
  noteText TextBlob
  noteDate Instant required
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223449")
@Filter
@Paginate("pagination")
entity Product {
  name String
  description String
  productKey Integer min(0) max(999)
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223450")
@Filter
@Paginate("pagination")
entity ProtectedClass {
  code Integer min(0) max(9) required
  name String maxlength(128)
  description String maxlength(1024)
}
@ChangelogDate("20240509223451")
@Filter
@Paginate("pagination")
entity Release {
  version String
  releaseDate Instant
}
@ChangelogDate("20240509223452")
@Filter
@Paginate("pagination")
entity Royalty {
  name String maxlength(10) required
  description String
}
@ChangelogDate("20240509223453")
@Filter
@Paginate("pagination")
entity Section {
  sectionKey String maxlength(10) required
  name String maxlength(128) required
  selfReported Boolean
  modeled Boolean
  thirdParty Boolean
  areaLevel Boolean
  compiled Boolean
  updatedDaily Boolean
  updatedWeekly Boolean
  updatedBiWeeekly Boolean
  updatedMonthly Boolean
  updatedSixWeeeks Boolean
  updatedQuatrerly Boolean
  updatedSemiAnnually Boolean
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223454")
@Filter
@Paginate("pagination")
entity SourceType {
  code String maxlength(10) required
  name String maxlength(128)
  description String maxlength(1024)
}
@ChangelogDate("20240509223455")
@Filter
@Paginate("pagination")
entity Step {
  completed Boolean
  notes TextBlob
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223456")
@Filter
@Paginate("pagination")
entity Task {
  name String required
  taskUser String maxlength(25) required
  taskOrder Integer
  showOnMainPage Boolean
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223457")
@Filter
@Paginate("pagination")
entity Universe {
  code String maxlength(10) required
  name String maxlength(128) required
}
@ChangelogDate("20240509223458")
@Filter
@Paginate("pagination")
entity UPC {
  upcKey String maxlength(15)
  name String maxlength(250) required
  description String maxlength(1024)
  dataSource TextBlob
  keywords TextBlob
  userNotes TextBlob
  restrictedResellerFlag Boolean
  hidden Boolean
  createUser String required
  createDate Instant required
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223459")
@Filter
@Paginate("pagination")
entity UPCRule (upc_rule) {
  ruleText TextBlob required
  ruleDate Instant required
  createUser String
  createDate Instant
  modifyUser String
  modifyDate Instant
}
@ChangelogDate("20240509223500")
@Filter
@Paginate("pagination")
entity Usage (jhi_usage) {
  action String required
  parm String
  user String maxlength(25) required
  dateTime Instant required
}

relationship OneToOne {
  PlatformDE{platform} to Platform{de}
  PlatformInst{platform} to Platform{install}
  PlatformList{platform} to Platform{list}
}
relationship OneToMany {
  Dimension{categories required} to Category
  Platform{values required} to FieldValue
  UPC{rules} to UPCRule{upc required}
  UPC{privateNotes} to PrivateNotes{upc required}
  UPC{platforms required} to Platform{upc required}
  UPC{steps} to Step
}
relationship ManyToOne {
  Dimension{universe} to Universe
  Platform{release} to Release
  Platform{category} to Category{platform}
  Platform{platformType} to PlatformType
  PlatformDE{section} to Section
  Product{platformType} to PlatformType
  Step{task} to Task
  UPC{attribute required} to Attribute
  UPC{category required} to Category
  UPC{protectedClass} to ProtectedClass
  UPC{epsilonDataSource} to EpsilonDataSource
  UPC{royalty} to Royalty
}
relationship ManyToMany {
  Platform{product} to Product{platform}
  UPC{sourceType} to SourceType{upc}
  UPC{derivation} to Derivation{upc}
}

search Attribute, Category, Derivation, Dimension, EpsilonDataSource, FieldValue, Platform, PlatformDE, PlatformInst, PlatformList, PlatformType, PrivateNotes, Product, ProtectedClass, Release, Royalty, Section, SourceType, Step, Task, Universe, UPC, UPCRule, Usage with no

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System

Windows 11, MS Edge

  • [X] Checking this box is mandatory (this is just to show you read everything)

naris avatar Jun 04 '24 18:06 naris