Option to deactivate apiHost validation, to allow forwarding to localhost
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 30/100
Direzione di ricerca
Inizia da AbstractRootProvider.checkForValidApiHost() e segui il modo in cui DefaultConnectionContext.builder() fornisce apiHost. Determina come rendere facoltativa la convalida mantenendo il comportamento predefinito esistente, quindi verifica che localhost:4201 possa essere accettato per l'inoltro senza l'attuale IllegalArgumentException.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
We are using ReactorCloudFoundryClient to connect to the CF-API.
Version used:
<dependency>
<groupId>org.cloudfoundry</groupId>
<artifactId>cloudfoundry-client-reactor</artifactId>
<version>5.6.0.RELEASE</version>
</dependency>
We provide this class with its connection context by building an instance of DefaultConnectionContext:
private DefaultConnectionContext getDefaultConnectionContext() {
return DefaultConnectionContext.builder()
.apiHost(config.getApiEndpoint())
.build();
}
As you can see, the builder reads the property apiHost from our app-config.
The CF-ApiEndpoint we want to connect to changes depending on the current target-environment. The application that implements ReactorCloudFoundryClient doesn't know about this environment though.
Instead, we send all http-traffic to a second, locally running application which knows about the current target environment.
For the above mentioned use-case, we have to set apiHost to localhost:4201, so the traffic is forwarded to our second, environment-aware application.
Using this setup, the following exception occurs upon building the DefaultConnectionContext instance:
IllegalArgumentException: "API hostname http://localhost:4201 is not correctly formatted (e.g. 'api.local.pcfdev.io')"
Looking at the call-stack, it seems like this method checkForValidApiHost() in AbstractRootProvider is causing the issue for us:
@Check
public final void checkForValidApiHost() {
Matcher matcher = HOSTNAME_PATTERN.matcher(this.getApiHost());
if (!matcher.matches()) {
throw new IllegalArgumentException(String.format("API hostname %s is not correctly formatted (e.g. 'api.local.pcfdev.io')", this.getApiHost()));
}
}
We already considered multiple options to workaround this limitation in the apiHost-string-syntax, but so far we couldn't find any working solution sadly..
Do you guys maybe know a way to get around this validation-step of the apiHost property? Or is there any chance that we can disable this validation if needed, maybe through an additional building-param?
Thanks already for any help about this matter!
- Lingua principale
- Java
- Stelle
- 334
- Fork
- 319
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cloudfoundry/cf-java-client
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
cloudfoundry/cf-java-client#1374 ·
-
Integration tests fail: test-service-broker.jar incompatible with java-buildpack v5 (JDK 17 default) Aperta
Difficoltà 2/5 Mezza giornata Idoneità per principianti 74/100
cloudfoundry/cf-java-client#1344 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
cloudfoundry/cf-java-client#1373 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
cloudfoundry/cf-java-client#1370 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
cloudfoundry/cf-java-client#1367 ·
Tutte le issue di cloudfoundry/cf-java-client
Issue simili
-
certification
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's Apertabug ecr
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
Needs: Triage Type: Feature request
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
github/copilot-sdk#2760 ·