GithubHelp home page GithubHelp logo

Comments (8)

75lb avatar 75lb commented on September 27, 2024

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.

mgalante avatar mgalante commented on September 27, 2024

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.

75lb avatar 75lb commented on September 27, 2024

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.

75lb avatar 75lb commented on September 27, 2024

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.

75lb avatar 75lb commented on September 27, 2024

however, this command hangs:

$ curl -i http://localhost:8000/lloyd/post.php -d '{"someKey": "someValue"}'

will look into it..

from local-web-server.

75lb avatar 75lb commented on September 27, 2024

are you sure the issue is not server side? your PHP script is hanging, do you understand why?

from local-web-server.

mgalante avatar mgalante commented on September 27, 2024

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.

75lb avatar 75lb commented on September 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.