Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request / Advice] Proxy server for cross domain #66

Open
coladarci opened this issue Feb 29, 2024 · 0 comments
Open

[Feature Request / Advice] Proxy server for cross domain #66

coladarci opened this issue Feb 29, 2024 · 0 comments

Comments

@coladarci
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant