Option to deactivate apiHost validation, to allow forwarding to localhost
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
Línea de trabajo
Comienza con AbstractRootProvider.checkForValidApiHost() y sigue cómo DefaultConnectionContext.builder() proporciona apiHost. Determina cómo se podría hacer opcional la validación conservando el comportamiento predeterminado existente y, a continuación, verifica que localhost:4201 pueda aceptarse para el reenvío sin la IllegalArgumentException actual.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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!
- Lenguaje dominante
- Java
- Estrellas
- 334
- Forks
- 319
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de cloudfoundry/cf-java-client
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
cloudfoundry/cf-java-client#1374 ·
-
Integration tests fail: test-service-broker.jar incompatible with java-buildpack v5 (JDK 17 default) Abierto
Dificultad 2/5 Medio día Aptitud para principiantes 74/100
cloudfoundry/cf-java-client#1344 · 1 comentario ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
cloudfoundry/cf-java-client#1376 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
cloudfoundry/cf-java-client#1373 ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
cloudfoundry/cf-java-client#1370 ·
Todos los issues de cloudfoundry/cf-java-client
Issues similares
-
Bug Java Platform: Java
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
getsentry/sentry-java#6138 · 1 comentario ·
-
bug needs triage p2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 comentario ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
apache/rocketmq-dashboard#4654 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100