-
Notifications
You must be signed in to change notification settings - Fork 79
Description
If I'm hosting a static single page app, this package is a godsend, appreciate it so much.
My question comes when this SPA makes cross-domain calls to an api server; it can work but the overhead of the options requests, the sketchiness of CORS, etc, can cause some problems/complexity.
In other projects, I've setup something where /api is a proxy service that takes /api/* and passes on all headers, paths, etc to a predefined host.
I'm curious if anyone has any advice on how to pull this off w/ this or a similar project.
My Dockerfile w/ an example of how I might use the proxy:
FROM pierrezemb/gostatic
COPY build/web/. /srv/http/
CMD ["-port","8080", "-proxy-suffix", "api , "-proxy-url" ,"https://api.example.com", "-https-promote", "-enable-logging"]
Then if this Dockerfile was deployed to static.example.com and that project has an API call that it's GET /api/foo/1, it'd be a local request but would get proxied to GET https://api.example.com/foo/1 eliminated cross domain requests.
Thanks for any advice; I'd be more than happy to try this out on my own if it would be of interest.