Skip to content

Prefer configured HTTPS Swagger server for same host#67

Merged
eviltester merged 1 commit into
masterfrom
codex/prefer-configured-https-swagger-server
Jul 17, 2026
Merged

Prefer configured HTTPS Swagger server for same host#67
eviltester merged 1 commit into
masterfrom
codex/prefer-configured-https-swagger-server

Conversation

@eviltester

Copy link
Copy Markdown
Owner

Summary

  • when Swagger generation is asked to prefer an http current request, reuse a configured https server for the same host instead of adding an http current-request server
  • keep localhost first for local development
  • add server ordering regression tests for localhost and production host behavior

Why

Production API Challenges is served over HTTPS, but its reverse proxy can leave the app seeing http://apichallenges.eviltester.com as the request origin. The API definition already declares https://apichallenges.eviltester.com, so Swagger should prefer that configured secure server and avoid generating a browser-breaking HTTP server URL.

Verification

  • mvn -pl thingifier '-Dtest=uk.co.compendiumdev.thingifier.swaggerizer.SwaggerizerServerPreferenceTest,uk.co.compendiumdev.thingifier.adapter.httpserver.HttpRequestOriginTest' test
  • mvn -pl thingifier -DskipTests install
  • mvn -pl challenger '-Dtest=uk.co.compendiumdev.uirouting.UiPagesAreReachableTest#canFetchDefaultOpenApiJsonForSwaggerUi+canFetchOpenApiJsonForSwaggerUiBehindHttpsProxy' test (from apichallenges, using locally installed Thingifier snapshot)

Copilot AI review requested due to automatic review settings July 17, 2026 08:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@eviltester
eviltester merged commit 7d94eea into master Jul 17, 2026
3 checks passed
@eviltester
eviltester deleted the codex/prefer-configured-https-swagger-server branch July 17, 2026 08:30

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff90d5273b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

if (preferredUri.getPort() == -1 && configuredUri.getPort() == -1) {
return true;
}
return effectivePort(preferredUri) == effectivePort(configuredUri);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat explicit HTTP default ports as the same external host

When the reverse proxy supplies an origin such as http://apichallenges.eviltester.com:80 while the configured server is https://apichallenges.eviltester.com, this comparison returns false (80 != 443). preferServer then adds the HTTP current-request server instead of reusing the HTTPS server, recreating the browser-breaking mixed-content URL this change is intended to avoid. The no-port variant succeeds through the preceding special case, so default-port spelling alone changes the result.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants