项目作者: kaishuu0123

项目描述 :
Simple reverse proxy for CORS issue.
高级语言: Go
项目地址: git://github.com/kaishuu0123/cors-reverse-proxy.git
创建时间: 2020-07-16T09:16:27Z
项目社区:https://github.com/kaishuu0123/cors-reverse-proxy

开源协议:MIT License

下载


CORS Reverse Proxy

GitHub release
Docker Pulls
Go Report Card

Simple reverse proxy for CORS issue.

  1. ... has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

Use Case

  • Local development
  • When you want to trust the resources of a other container
    • ex. minio, draw.io, piwigo etc …

Usage

  1. docker pull kaishuu0123/cors-reverse-proxy
  2. docker run -it -d \
  3. -e CORS_REVERSE_PROXY_TARGET_URL=http://httpbin.org \
  4. -e CORS_REVERSE_PROXY_HOST=0.0.0.0 \
  5. -p 8181:8081 \
  6. --name cors-reverse-proxy \
  7. kaishuu0123/cors-reverse-proxy

or

  1. go build
  2. ./cors-reverse-proxy \
  3. --target-url http://httpbin.org \
  4. --host 0.0.0.0
  5. --port 8888

Command Line Options & Environment Variables

CLI Option(Long) Shorthand Environment Variables Example Default
—target-url -t CORS_REVERSE_PROXY_TARGET_URL http://example.com/
—host -h CORS_REVERSE_PROXY_HOST 0.0.0.0 localhost
—port -p CORS_REVERSE_PROXY_PORT 8888 8081
—origin -o CORS_REVERSE_PROXY_ORIGIN http://example.com/ *
—debug false

Inspired by