Skip to content

Commit e490670

Browse files
committed
BREAKING CHANGE: renamed to @isomorphic-git/cors-proxy
1 parent 9e90f0a commit e490670

File tree

4 files changed

+3705
-55
lines changed

4 files changed

+3705
-55
lines changed

README.md

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
1-
# git-cors-proxy
2-
3-
## What is this?
1+
# @isomorphic-git/cors-proxy
42

53
This is the software running on https://git-cors-proxy.now.sh, a free
64
service for users of isomorphic-git so you can clone and push repos in the browser.
75

86
It is derived from https://github.com/wmhilton/cors-buster with added restrictions to prevent abuse.
97

8+
## Installation
9+
10+
```sh
11+
npm install @isomorphic-git/cors-proxy
12+
```
13+
14+
## Configuration
15+
16+
Environment variables:
17+
- `PORT` the port to listen to
18+
- `ALLOW_ORIGIN` the value for the 'Access-Control-Allow-Origin' CORS header
19+
20+
1021
## License
1122

1223
This work is released under [The MIT License](https://opensource.org/licenses/MIT)

index.js

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,18 @@ const exposeHeaders = [
3838
'vary',
3939
'x-github-request-id',
4040
]
41+
const allowMethods = [
42+
'POST',
43+
'GET',
44+
'OPTIONS'
45+
]
4146
const fetch = require('node-fetch')
42-
const cors = require('./micro-cors.js')({allowHeaders, exposeHeaders, origin})
47+
const cors = require('./micro-cors.js')({
48+
allowHeaders,
49+
exposeHeaders,
50+
allowMethods,
51+
origin
52+
})
4353
const allow = require('./allow-request.js')
4454

4555
async function service (req, res) {
@@ -50,12 +60,27 @@ async function service (req, res) {
5060
let html = `<!DOCTYPE html>
5161
<html>
5262
<title>@isomorphic-git/cors-proxy</title>
53-
<h1>@isomorphic-git/cors-proxy</h1>
54-
<h2>See docs: <a href="https://npmjs.org/package/${pkg.name}">https://npmjs.org/package/${pkg.name}</a></h2>
63+
<h1> <a href="https://npmjs.org/package/${pkg.name}">@isomorphic-git/cors-proxy</a> </h1>
64+
This is the software running on https://git-cors-proxy.now.sh, a free service for users of isomorphic-git so you can clone and push repos in the browser.
65+
It is derived from <a href="https://github.com/wmhilton/cors-buster">cors-buster</a> with added restrictions to prevent abuse.
66+
<h2>Terms of Use</h2>
67+
<p><b>This free service is provided to you AS IS with no guarantees.
68+
By using this free service, you promise not to use excessive amounts of bandwidth.
69+
This server can only support 50 gigabytes of data / month.
70+
Please clone responsibly.</b></p>
71+
72+
<p><b>If you are cloning or pushing large amounts of data your IP address may be banned.
73+
Please run your own instance of the software (or <a href="https://opencollective.com/isomorphic-git">donate money</a> to isomorphic-git)
74+
if you need to make heavy use this service.</b></p>
75+
76+
<h2>Allowed Origins</h2>
77+
This proxy allows git clone / fetch / push / getRemoteInfo requests from these domains: <code>${process.env.ALLOW_ORIGIN || '*'}</code>
78+
5579
<h2>Authenticity</h2>
5680
This is a publicly available service. As such you may wonder if it is safe to trust.
5781
You can inspect the source code that this server is running by visiting this page: <a href="/_src">/_src</a>.
5882
The deploys are immutable, so you can be sure that the code will never change.
83+
5984
<h2>Logging</h2>
6085
The cloud hosting provider keeps log of all requests. That log is public and available on this page: <a href="/_logs">/_logs</a>.
6186
It records the URL, origin IP, referer, and user-agent. None of the sensitive HTTP headers (including those used for

0 commit comments

Comments
 (0)