Option to deactivate apiHost validation, to allow forwarding to localhost
まだ誰も着手していません。
評価
調査の方向性
AbstractRootProvider.checkForValidApiHost() から始め、DefaultConnectionContext.builder() が apiHost をどのように提供しているかを追跡します。既存のデフォルト動作を維持したまま検証を任意にする方法を特定し、そのうえで、現在の IllegalArgumentException を発生させずに localhost:4201 を転送先として受け入れられることを確認します。
索引モデルが issue の本文から書いたものです。
説明
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!
- 主要言語
- Java
- スター
- 334
- フォーク
- 319
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
cloudfoundry/cf-java-client のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
cloudfoundry/cf-java-client#1374 ·
-
Integration tests fail: test-service-broker.jar incompatible with java-buildpack v5 (JDK 17 default) オープン
難易度 2/5 半日 初心者へのやさしさ 74/100
cloudfoundry/cf-java-client#1344 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
cloudfoundry/cf-java-client#1376 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
cloudfoundry/cf-java-client#1373 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
cloudfoundry/cf-java-client#1370 ·
cloudfoundry/cf-java-client の issue をすべて見る
似ている issue
-
Bug Java Platform: Java
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
getsentry/sentry-java#6138 · コメント 1 件 ·
-
bug needs triage p2
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · コメント 1 件 ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
apache/rocketmq-dashboard#4654 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100