Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zenhack/powerbox-http-proxy
https://github.com/zenhack/powerbox-http-proxy
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/zenhack/powerbox-http-proxy
- Owner: zenhack
- License: apache-2.0
- Created: 2020-08-02T23:00:33.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T19:51:04.000Z (almost 2 years ago)
- Last Synced: 2024-05-01T12:59:15.623Z (8 months ago)
- Language: Go
- Size: 43.9 KB
- Stars: 4
- Watchers: 3
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: license.txt
Awesome Lists containing this project
README
`powerbox-http-proxy` is a daemon that is sometimes helpful for
porting legacy applications that want HTTP access to [Sandstorm][1]. It
acts as an HTTP proxy, and makes powerbox requests on-demand for domains
that the legacy application tries to access. It is used by the [Tiny
Tiny RSS Port](https://github.com/zenhack/ttrss-sandstorm)# Building
Install a recent Go toolchain and run:
```
go build
```This will create an executable `powerbox-http-proxy`.
# Configuration
To use `powerbox-http-proxy` with your application, you need to do the
following:- Build the daemon, per the above instructions.
- Add a `` tag to your pages which includes
`powerbox-http-proxy.js` (from the root of this repository).
- Arrange for the url `/_sandstorm/websocket` to be served by the
daemon; see below.
- Arrange for your application to trust a root TLS cert generated by
the daemon; this is necessary to proxy HTTPS requests.The daemon is mainly configured through environment variables:
- `POWERBOX_PROXY_PORT` specifies the port that the daemon should listen
on for proxy requests; you should configure your application to use
`http://localhost:$POWERBOX_PROXY_PORT` as its proxy for both http
and https. Many applications will observe the variables `http_proxy`
and `https_proxy`, so you can often make this happen by just defining
those variables.
- `POWERBOX_WEBSOCKET_PORT` specifies the port to listen on for connections
from the JavaScript helper. You will want to configure your web server
to point requests to `/_sandstorm/websocket` to this port. For example,
for nginx, assuming `POWERBOX_WEBSOCKET_PORT` is `3000`, you can use:location /_sandstorm/websocket {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}- `CA_CERT_PATH` is the path to which the daemon should write its root
certificate. Configure your application to trust the cert written
to this location.
- `DB_TYPE`: The type of the database to use. Supported values are:
- `mysql` for MySQL/MariaDB
- `sqlite3` for SQLite.
- `DB_URI`: The location of a mysql database in which to store the
daemon's private data. The format depends on the value of DB_TYPE.
- For SQLite, this should be the path to the database file.
- For MySQL, see
<https://github.com/go-sql-driver/mysql#dsn-data-source-name> for
a description of the format.[1]: https://sandstorm.io