swagger-api / swagger-api/swagger-ui

Wrong Request URL when using Proxy

Open
#8,695 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
29k
Forks
9.3k
Avg merge
2d 23h
Merged PRs (30d)
25

Description

Q&A
  • OS: Windows
  • Browser: Chrome
  • Version: 113.0.5672.127
  • Method of installation: autogenerated by Visual Studio
  • Swagger-UI version: 3.52.1
  • Swagger/OpenAPI version: [e.g. Swagger 2.0, OpenAPI 3.0]
Description

I am using two docker containers. The first one is an API, which works fine on some port, say

       localhost:7000.

The swagger-ui also works as expected on

       localhost:7000/swagger.

The second container refers to the first one via proxy and runs the API on some URL, say

       localhost:6000/nameofapi.

The swagger-ui is also available on

       localhost:6000/nameofapi/swagger.

When I want to try out some endpoint on

       localhost:6000/nameofapi/swagger,

I noticed that the request URL that swagger uses to access the endpoint, is

       localhost:6000/someendpoint

instead of

       localhost:6000/nameofapi/someendpoint,

which does not work.

Is there a way to solve this? How can I set the request URL?

Thanks in advance!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the request through the two-container proxy setup, comparing the generated URL with and without the /nameofapi path. Trace how Swagger UI derives the endpoint URL from the served path and API definition; done means Try it out requests retain the proxy path and reach the endpoint.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.