https://github.com/klemek/yxorp
A simple proxy for totally legal purposes
https://github.com/klemek/yxorp
Last synced: 6 months ago
JSON representation
A simple proxy for totally legal purposes
- Host: GitHub
- URL: https://github.com/klemek/yxorp
- Owner: Klemek
- Created: 2020-01-10T21:17:44.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T14:32:34.000Z (over 2 years ago)
- Last Synced: 2024-04-21T10:24:23.521Z (about 1 year ago)
- Language: JavaScript
- Size: 90.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yxorp
A simple proxy for totally legal purposesProxy your requests and rewrite pages/styles to follow the same rule
### To use :
```
node server.js [port] [proxy-origin] [index page]
```proxy-origin should be as "http(s)://your.host"
It will be placed before every link so be sure to change it when needed
### To install :
```
git clone https://github.com/Klemek/yxorp
cd yxorp
npm install
npm install -g nodemon
nodemon ./server.js 3000
# started on localhost:3000
# go to http://localhost:3000/stackoverflow.com (it should works there)
```### Disclaimer : reasons it might break
1. (on localhost) websites that doesn't like "being" on another port
2. websites that doesn't like not being the host
3. dynamic HTTP queries created in scripts
4. non-GET method### How it works
#### Proxying request
When you reach `https:///google.com/index.html` it will send a request to `https://google.com/index.html` from it's own and retreive you the response.
#### Identifying URLs in response
The response is also modified so that you can receive all resources the same way.
* All files
* full URLs `https://google.com/image.png`
* CSS and HTML files
* CSS URLs `url(https://google.com/image.png)`
* JS and HTML files
* identified domains `//google.com/`
* identified escaped domains `\/\/google.com\/`
* HTML files
* common html attributes
* `src="https://google.com/script.js"`
* `href='/style.css'`#### Rewriting URLs in response
All following URLs are rewritten as `https:///google.com/favicon.ico`:
Type | Input Example
--- | ---
full URL with protocol | `https://google.com/favicon.ico`
full URL without protocol | `//google.com/favicon.ico`
root path URL* | `/favicon.ico`\* can be rewritten with cache-saved target host (identified by the first request containing the `upgrade-insecure-requests` header)