https://github.com/sebogh/proxy-swagger
https://github.com/sebogh/proxy-swagger
nginx proxy swagger-ui
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sebogh/proxy-swagger
- Owner: sebogh
- License: mit
- Created: 2025-03-18T12:00:34.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-20T18:45:56.000Z (over 1 year ago)
- Last Synced: 2025-06-16T19:53:37.900Z (about 1 year ago)
- Topics: nginx, proxy, swagger-ui
- Language: HTML
- Homepage:
- Size: 2.39 MB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# proxy-swagger
## Motivation
Swagger UI without CORS issues.
## Solution
Create a Docker image (derived from Nginx), which serves the Swagger UI and
proxies requests (e.g. for "Try Out") to the target service.
## Getting Started
````sh
make build
````
to create a `proxy-swagger` Docker image.
Then run like:
````sh
docker run --rm --network=host \
-v ${PWD}/openapi.yaml:/usr/share/nginx/html/openapi.yaml:ro \
--name proxy-swagger sebodockerhub/proxy-swagger
````
and surf to .
adapting `${PWD}/openapi.yaml` as needed.
## dockerhub
## ENV
### API_URL
One may override the URL of the API by setting the `API_URL` environment
variable (default `http://localhost:8080`). For example, using port `9090`
(instead of `8080`):
````sh
docker run --rm --network=host \
-v ${PWD}/openapi.yaml:/usr/share/nginx/html/openapi.yaml:ro \
-e "API_URL=http://localhost:9090" \
--name proxy-swagger sebodockerhub/proxy-swagger
````
Or targeting a remote service (https://httpbin.org):
````sh
docker run --rm --network=host \
-v ${PWD}/openapi.yaml:/usr/share/nginx/html/openapi.yaml:ro \
-e "API_URL=https://httpbin.org" \
--name proxy-swagger sebodockerhub/proxy-swagger
````
### SWAGGER_PORT
One may override the proxy- / Swagger-port by setting the `SWAGGER_PORT`
environment variable (default `3000`). For example, using port `4711`:
````sh
docker run --rm --network=host \
-v ${PWD}/openapi.yaml:/usr/share/nginx/html/openapi.yaml:ro \
-e "SWAGGER_PORT=4711" \
--name proxy-swagger sebodockerhub/proxy-swagger
````