Aflred
Aflred

Reputation: 4593

Light Httpd rewrite mod, body is empty

My body is empty in lighthttpd if i use rewrite.

I just want to rewrite everything to index.php except images and css.

I have the following:

url.rewrite-if-not-file = ( "^/(.*)" => "/index.php" )

I cannot post the entire lighthttpd configuration because stackoverflow will not let me.Here is the link: https://pastebin.com/aku217CN

However when i try to get the raw body via file_get_contents('php://input') it comes up as null.

However when i try to go to the default mywebsite/index.php, the body is filled up.

Upvotes: 1

Views: 80

Answers (2)

gstrauss
gstrauss

Reputation: 2404

User error. After request body is consumed, it is, well, consumed. You can not read request body more than once. You must read it and save it if something else in your script needs it again.

Upvotes: 1

Aflred
Aflred

Reputation: 4593

It seems this was related to the php flight which runs on lighthttpd latest version.

Once you read the body, with file_get_contents('php://input') yuou cannot read it a second time.

I had a sort of filter that read the body and put it in a log.

NEeds closed.

Upvotes: 0

Related Questions