Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
epse36616yI have no clue what you are doing wrong... There isn't that much to do wrong.. You know about nginx -t do you?
-
@epse Some rewrite stuff but then again, when calling through curl it all shows well
-
@linuxxx php has some weird stuff with output buffering, some very convoluted settings as far as I can remember, but basically, look into the functions starting with "ob_" like "ob_start()" for example.
Sometimes your configuration is fucked up and you either need to edit it or use "ob_flush()" to output the buffer. -
@epse I've had some weird stuff with configuration conflicts causing output buffering to turn on when I didn't want it to and turn off when I did want the buffering, was à few years ago tho, so not that up to date...
-
Are you sure it is nginx?
You said when you echo all good, no echo no data.
Lazy loading? I know not related but when dealing with Entity Framework (DotNet) if we are calling a navigation property of a table (foreign key relation) and lazy loading is enabled, result is always null, but right after if we call it again data is there.
I'm not a php dev, but what if that echo caused that tiny delay needed for data to get ready and be sent? Though you are echo'ing your data but still your scenario reminds me of EF and lazy loading -
@Root You mean use Dotnet on windows server, that will annoy the hell out of him lol
-
@ewpratten aaah even better lol
Jokes aside, I hear that powershell is actually powerful, I never used it tbh, never been good in terminal stuff under MS OS's :\ -
@gitpush it was nginx which wasn't (for some fucking reason) putting in right cors headers.
Hacked a solution together with php now which works! -
alkuzad14806yCurl is dumb hammer which does not add any headers by itself. Browsers do use them frequently and check if they are correct.
Finally got my nginx config to work properly (it shouldn't work but it does so I'm not fucking touching it).
Request with curl: check, right http code and getting data back properly.
Request with any browser (with and without incognito): right http code, AND ONLY SEEING DATA WHEN I ECHO ANYTHING BEFORE SENDING THE RESPONSE WITH PHP. When I don't echo whatever before sending the response, the browser doesn't see the data but DOES see the http status code.
HOW?!
rant