bulletmark / corsproxy Goto Github PK
View Code? Open in Web Editor NEWA simple CORS proxy server.
A simple CORS proxy server.
hi,
I have a Pi with stretch on it (updated from Wheezy to Jessie then to stretch) and trying to setup corsproxy for the fronius power monitor.
Im having some trouble when running through the read me... im quite new to linux so something's are over my head and things that are obvious and expected I don't even know about.
I get up to this line in the read me venv/bin/pip install -r requirements.txt
and get a few errors along the way. theres is snippets removed at they are just installing without issues
Cache entry deserialization failed, entry ignored
Using cached https://files.pythonhosted.org/packages/c8/18/631398e45c109987f2d 8e57f3adda161cc5ff2bd8738ca830c3a2dd41a85/gevent-21.12.0.tar.gz
Ignoring cffi: markers 'platform_python_implementation == "CPython" and sys_pl atform == "win32"' don't match your environment
Building wheels for collected packages: gevent
Running setup.py bdist_wheel for gevent ... error
Complete output from command /root/corsproxy/venv/bin/python3 -u -c "import se tuptools, tokenize;__file__='/tmp/pip-build-df7uiq52/gevent/setup.py';f=getattr( tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close(); exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmplt88ga7spip-wheel- --python-tag cp35:
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution op tion: 'project_urls'
warnings.warn(msg)
/usr/lib/python3.5/distutils/dist.py:261: UserWarning: Unknown distribution op tion: 'cffi_modules'
warnings.warn(msg)
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: -c --help [cmd1 cmd2 ...]
or: -c --help-commands
or: -c cmd --help
error: invalid command 'bdist_wheel'
----------------------------------------
Failed building wheel for gevent
Running setup.py clean for gevent
Failed to build gevent
followed through the rest of the readme and had a problem with vim ~/.config/corsproxy # Add the target servers
as im not really sure what I need to put in here? is this just the port number and Inverter ip address? 8000:192.168.1.111?
then get to the last step
sudo vim /etc/systemd/system/corsproxy.service # Edit #TEMPLATE# values.
I edited the template but after enabling and starting the service then checking the status I get this error I first thought it was editing the template wrong but now looking at the errors I think its from the first issue.
● corsproxy.service - CORS Proxy Service
Loaded: loaded (/etc/systemd/system/corsproxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-01-19 17:59:53 ACDT; 5s ago
Process: 8722 ExecStart=/root/corsproxy/corsproxy (code=exited, status=1/FAILURE)
Main PID: 8722 (code=exited, status=1/FAILURE)`
`Jan 19 17:59:53 raspberrypi systemd[1]: Started CORS Proxy Service.
Jan 19 17:59:53 raspberrypi corsproxy[8722]: Traceback (most recent call last):
Jan 19 17:59:53 raspberrypi corsproxy[8722]: File "/root/corsproxy/corsproxy", line 7, i
Jan 19 17:59:53 raspberrypi corsproxy[8722]: from gevent import monkey; monkey.patch_a
Jan 19 17:59:53 raspberrypi corsproxy[8722]: ImportError: No module named 'gevent'
Jan 19 17:59:53 raspberrypi systemd[1]: corsproxy.service: Main process exited, code=exite
Jan 19 17:59:53 raspberrypi systemd[1]: corsproxy.service: Unit entered failed state.
Jan 19 17:59:53 raspberrypi systemd[1]: corsproxy.service: Failed with result 'exit-code'.
lines 1-14/14 (END)...skipping...
● corsproxy.service - CORS Proxy Service
Loaded: loaded (/etc/systemd/system/corsproxy.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2022-01-19 17:59:53 ACDT; 5s ago
Process: 8722 ExecStart=/root/corsproxy/corsproxy (code=exited, status=1/FAILURE)
Main PID: 8722 (code=exited, status=1/FAILURE)`
`Jan 19 17:59:53 raspberrypi systemd[1]: Started CORS Proxy Service.
Jan 19 17:59:53 raspberrypi corsproxy[8722]: Traceback (most recent call last):
Jan 19 17:59:53 raspberrypi corsproxy[8722]: File "/root/corsproxy/corsproxy", line 7, in <module
Jan 19 17:59:53 raspberrypi corsproxy[8722]: from gevent import monkey; monkey.patch_all() # no
Jan 19 17:59:53 raspberrypi corsproxy[8722]: ImportError: No module named 'gevent'
Jan 19 17:59:53 raspberrypi systemd[1]: corsproxy.service: Main process exited, code=exited, status
Jan 19 17:59:53 raspberrypi systemd[1]: corsproxy.service: Unit entered failed state.
Jan 19 17:59:53 raspberrypi systemd[1]: corsproxy.service: Failed with result 'exit-code'.
```
`
Hi!
Your instructions for Docker are a bit... opaque...
$ docker run --restart always -d -p 8000:8000 bulletmark/corsproxy 8000=http://192.168.1.98
It appears that your software, inside of the container, is listening on port 8000 - is that correct? So does the 8000 in the argument refer to the external 8000 port, or the internal 8000 port?
If i wanted to receive requests on port 5000 and forward them to 192.168.1.1:9000, what would the equivalent docker command look like? I'm having problems understanding when everything is 8000 :-)
Cheers!
I have a rPI 2 B running Bullseye Fresh install.
have installed corsproxy via Readme.
it all works fine and running the proxy from the CLI I can get the proxy to work but when I add the IP's to the config file it errors
vim ~/.config/corsproxy # Add the target servers
the contents of the config file are
8000:192.168.1.111
but checking status get the error : No target host mappings defined
Guessing I have put the data in the file incorrectly?
the port and ip work fine from the command line when entering as
./corsproxy 8000:192.168.1.111
root@raspberrypi:~# systemctl status corsproxy
● corsproxy.service - CORS Proxy Service
Loaded: loaded (/etc/systemd/system/corsproxy.service; enabled; vendor pre>
Active: failed (Result: exit-code) since Sat 2022-01-22 13:22:51 ACDT; 1h >
Process: 322 ExecStart=/home/pi/corsproxy/corsproxy (code=exited, status=2)
Main PID: 322 (code=exited, status=2)
CPU: 4.654s
Jan 22 13:22:42 raspberrypi systemd[1]: Started CORS Proxy Service.
Jan 22 13:22:51 raspberrypi corsproxy[322]: usage: corsproxy [-h] [targets ...]
Jan 22 13:22:51 raspberrypi corsproxy[322]: corsproxy: error: No target host ma>
Jan 22 13:22:51 raspberrypi systemd[1]: corsproxy.service: Main process exited,>
Jan 22 13:22:51 raspberrypi systemd[1]: corsproxy.service: Failed with result '>
Jan 22 13:22:51 raspberrypi systemd[1]: corsproxy.service: Consumed 4.654s CPU >
lines 1-13/13 (END)
The docker container is not working.
To safe time of other people...
Just use https://hub.docker.com/r/saschabrockel/cors-container
working like a charm instead
My service is returning an image with a content-type : 'image/png' (tested by directly using my service with Postman)
But after passing my request through the proxy, the content-type is received as 'text/html; charset=UTF-8'
Can this response header be kept ??
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.