Comments (8)
doesn't work in what way? there is not enough information here.. can you send a reproduction case, or just more detail (your local-web-server config, details of what exactly is failing)
from local-web-server.
Ok here is the thing.
I create to VM in digital ocean
in one i create a post.php file its just
<?php var_dump($_POST)
in the other one i started local-web-server with a rule to forward all the traffic to the other server.
If i just make a post o get to post.php it works, but if i send something in the post content fails
I send the console output.
root@ubuntu-512mb-nyc3-01:~# ws --config
{
"port": 80,
"directory": "/root",
"forbid": [],
"rewrite": [
{
"from": "/*",
"to": "http://104.131.40.69/$1"
}
]
}
root@ubuntu-512mb-nyc3-01:~# ws
serving at http://ubuntu-512mb-nyc3-01:80, http://127.0.0.1:80, http://159.203.74.157:80, http://10.17.0.7:80
/usr/lib/node_modules/local-web-server/node_modules/koa/lib/context.js:91
throw createError.apply(null, arguments);
^
InternalServerError: [PROXY] socket hang up: http://104.131.40.69/post.php
at Object.throw (/usr/lib/node_modules/local-web-server/node_modules/koa/lib/context.js:91:23)
at ProxyServer.<anonymous> (/usr/lib/node_modules/local-web-server/lib/middleware.js:48:17)
at ProxyServer.emit (/usr/lib/node_modules/local-web-server/node_modules/eventemitter3/index.js:117:27)
at ClientRequest.proxyError (/usr/lib/node_modules/local-web-server/node_modules/http-proxy/lib/http-proxy/passes/web-incoming.js:141:16)
at emitOne (events.js:95:20)
at ClientRequest.emit (events.js:182:7)
at Socket.socketCloseListener (_http_client.js:238:9)
at emitOne (events.js:95:20)
at Socket.emit (events.js:182:7)
at TCP._onclose (net.js:471:12)
I ll leave the LAMP server UP so you can try it: http://104.131.40.69/post.php
It will be really usefull for me if you can fix this.
Thanks for your work and sorry for my pour description of the problem before. I just was in a hurry in my daytime job.
from local-web-server.
You have this rule
"rewrite": [
{
"from": "/*",
"to": "http://104.131.40.69/$1"
}
]
so a local url of /yeah
will proxy to http://104.131.40.69/yeah
.. what is the full local url you are sending the POST request to?
from local-web-server.
i set up a local web server with this config
{
"port": 8000,
"rewrite": [
{
"from": "/*",
"to": "http://104.131.40.69/$1"
}
]
}
if i run this command, it seems to work:
$ curl -i http://localhost:8000/post.php
HTTP/1.1 200 OK
date: Fri, 19 Feb 2016 10:50:36 GMT
server: Apache/2.4.7 (Ubuntu)
x-powered-by: PHP/5.5.9-1ubuntu4.14
content-length: 13
connection: close
content-type: text/html
array(0) {
}
from local-web-server.
however, this command hangs:
$ curl -i http://localhost:8000/lloyd/post.php -d '{"someKey": "someValue"}'
will look into it..
from local-web-server.
are you sure the issue is not server side? your PHP script is hanging, do you understand why?
from local-web-server.
Its not my php. If you execute the curl directly will work.
And i tried it also with a java servlet with the same result.
It happens with any post request with data.
from local-web-server.
isolated, confirmed, fixed and released in v1.1.1.. thanks for the report, please tell me if you have any more issues 👍
from local-web-server.
Related Issues (20)
- Spa per folder HOT 5
- Rewrite rules stopped working from npx on Windows HOT 10
- How to enable verbose option while using API of lws? HOT 2
- Server has no output when executed by node exec() HOT 3
- what's going on here? HOT 1
- Cannot consume package from TypeScript HOT 7
- Nodejs version not compatible: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: HOT 1
- Support Range Requests HOT 2
- How to change default 8000 port to another custom one ? HOT 1
- Custom 404 page HOT 1
- Output doesn't show the localhost and 192.168.xxx.xxx HOT 3
- Rewrite wildcard does not create the match HOT 3
- Override config file arguments from CLI HOT 2
- Middleware error HOT 2
- Server shuts down HOT 4
- Cannot find the port when running in docker HOT 3
- SyntaxError: Unexpected identifier HOT 1
- Allow passing more server options through lws.config.js
- auto reload? HOT 1
- Add the option to set a custom process title HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from local-web-server.