Hi!
I have a problem with setting up a public share - would greatly appreciate some help!
I am running a FastAPI server in Docker and want to expose it using ZROK since my server is behind a firewall. I am using a free-tier service -- not self-hosting. Here is my docker-compose.yml
(from the docs):
services:
# set file ownership
zrok-init:
image: busybox
# matches uid:gid of "ziggy" in zrok container image
command: chown -Rc 2171:2171 /mnt/
user: root
volumes:
- zrok_env:/mnt
# enable zrok environment
zrok-enable:
image: ${ZROK_CONTAINER_IMAGE:-docker.io/openziti/zrok}
depends_on:
zrok-init:
condition: service_completed_successfully
entrypoint: zrok-enable.bash
volumes:
- zrok_env:/mnt
environment:
HOME: /mnt
ZROK_ENABLE_TOKEN:
ZROK_API_ENDPOINT:
ZROK_ENVIRONMENT_NAME:
# reserve zrok frontend subdomain and start sharing the target
zrok-share:
image: ${ZROK_CONTAINER_IMAGE:-docker.io/openziti/zrok}
restart: unless-stopped
entrypoint: zrok-share.bash
depends_on:
zrok-enable:
condition: service_completed_successfully
volumes:
- zrok_env:/mnt
environment:
# internal configuration
HOME: /mnt # zrok homedir in container
# most relevant options
ZROK_UNIQUE_NAME: # name is used to construct frontend domain name, e.g. "myapp" in "myapp.share.zrok.io"
ZROK_BACKEND_MODE: # web, caddy, drive, proxy
ZROK_TARGET: # backend target, is a path in container filesystem unless proxy mode
ZROK_INSECURE: # "--insecure" if proxy target has unverifiable TLS server certificate
ZROK_OAUTH_PROVIDER: # google, github
ZROK_OAUTH_EMAILS: # allow space-separated list of OAuth email address glob patterns
ZROK_BASIC_AUTH: # username:password, mutually-exclusive with ZROK_OAUTH_PROVIDER
# least relevant options
ZROK_VERBOSE: # "--verbose"
ZROK_SHARE_OPTS: # additional arguments to "zrok reserve public" command
ZROK_FRONTENDS: # "public"
PFXLOG_NO_JSON: "true" # suppress JSON logging format
web:
# My FastAPI service...
ports:
- "8000:8000"
volumes:
zrok_env:
Also, here is my .env
:
ZROK_ENABLE_TOKEN="my-token"
ZROK_TARGET="http://web:8000"
ZROK_UNIQUE_NAME="my-anonymous-unique-name"
ZROK_INSECURE="--insecure"
ZROK_BACKEND_MODE="proxy"
Now, I have a JS frontend (Angular specifically) that is consuming my API. Unfortunately, I am running into CORS issues. I set up the FastAPI CORS middleware + I don't see a log indicating that request even reached the FastAPI. There is also no ZROK log I see when the request is sent. The endpoint works well when using curl or some other client. Only thing I see is the CORS issue in the browser.
Thank you for help in advance!