redoc/config/docker
Daniel Schosser 4512436f1d
fix: add security headers to Docker nginx config (#1244)
* Add security headers to nginx config

Increase the security of the nginx server and the served page, by adding the following security headers to the nginx config:
- X-Frame-Options (Disables click jacking by disallowing the page to be run in a frame/iframe)
- X-XSS-Protection (Enables cross site scripting filtering)
- X-Content-Type-Options (Disables MIME sniffing and forces browser to use the type given in Content-Type.)
- Content-Security-Policy (Controls resources the user agent is allowed to load for a given page.)
- Referrer-Policy (Governs which referrer information sent in the Referer header should be included with requests made.)

Additional headers that could be added optionally:
- Strict-Transport-Security (Enforce HTTPS over HTTP)
2020-05-14 10:33:09 +03:00
..
hooks doc: fix some typos (#1117) 2019-12-10 08:13:37 +02:00
docker-run.sh docker: Incorrect port after restart when PORT is 8080 (#776) 2019-01-10 10:06:51 +02:00
Dockerfile chore: migrate yarn -> npm 2020-03-17 11:06:03 +02:00
index.tpl.html fix: allow docker container serving under non-root URLs (#731) 2018-12-11 15:27:12 +02:00
nginx.conf fix: add security headers to Docker nginx config (#1244) 2020-05-14 10:33:09 +03:00
README.md Update README.md (#1130) 2020-05-09 14:32:27 +03:00

Official ReDoc Docker Image

Usage

Serve remote spec by URL:

docker run -it --rm -p 80:80 \
  -e SPEC_URL='http://localhost:8000/swagger.yaml' redocly/redoc

Serve local file:

docker run -it --rm -p 80:80 \
  -v $(pwd)/demo/swagger.yaml:/usr/share/nginx/html/swagger.yaml \
  -e SPEC_URL=swagger.yaml redocly/redoc

Serve local file and watch for updates:

docker run -it --rm -p 80:80 \
  -v $(pwd)/demo/:/usr/share/nginx/html/swagger/ \
  -e SPEC_URL=swagger/swagger.yaml redocly/redoc

Runtime configuration options

  • PAGE_TITLE (default "ReDoc") - page title
  • PAGE_FAVICON (default "favicon.png") - URL to page favicon
  • SPEC_URL (default "http://petstore.swagger.io/v2/swagger.json") - URL to spec
  • PORT (default 80) - nginx port
  • REDOC_OPTIONS - <redoc> tag attributes

Build

docker build -t redocly/redoc .