logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Coding & Scripting Corner View previous topic :: View next topic
Reply to topic   Topic: setting up apache2 with SSL on a Linux server
Author
richb201



Joined: 02 Oct 2018
Posts: 2
Location: USA, Montvale

PostPosted: Tue 02 Oct '18 22:32    Post subject: setting up apache2 with SSL on a Linux server Reply with quote

I have a Chrome Extension that talks to my application on a Bitnami LAMP server (on AWS). The application was written in PHP with Codeigniter and the communication from the ChromeExt is written in js and uses XMLhttpRequest and PUT. I have set this up on my localhost under WAMP and it runs fine (using localhost). I have also tried it on a shared server (under Windows) and it also runs fine. I have now loaded it on AWS under Linux (LAMP) and while the UI runs great, the communication between the ChromeExt and the bitnami servers Lamp just fails. I have to reboot the server each time I try it because the server gets into a state error 500, each time. This is the line from the error_log that breaks it.

malformed header from script 'index.php': Bad header: {"0":["{choose}","IOS","Mac","

That is my payload but MY code does not stick the payload into the header! And it works fine under Windows. The error only occurs under Linux. So I am thinking it must be my Linux or Apache config. There are so many damn config files under Linux. I have been stuck here for many weeks.

Can anyone suggest how I can debug this? I have tried ssldump, wireshark, running xdebug on the server, etc. I am using phpStorm and am fairly good with the debugger both on the server and with the Chrome debugger.
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 16 Oct '18 23:13    Post subject: Reply with quote

PLease post your SSL settings and small test script.

if too long use http://apaste.info/ or http://hastebin.com/
Back to top
richb201



Joined: 02 Oct 2018
Posts: 2
Location: USA, Montvale

PostPosted: Tue 16 Oct '18 23:22    Post subject: Reply with quote

Sorry, I don't know how to use apaste.info but it did make a really nice display! Do I just copy that and paste it in here?

Anyway, I think there is something about my POST that is causing the server to go to error 500.
var xhr = new XMLHttpRequest();
xhr.onerror = function(req,textStatus,errorThrown) {
console.log(textStatus);
alert('on-error')};

xhr.open('POST', url, true);
// xhr.open('GET', url, true);
// xhr.setRequestHeader("Content-type", 'application/json');
xhr.setRequestHeader("Content-type", 'text/plain');

xhr.setRequestHeader("X-Requested-With",'xmlhttprequest');
xhr.setRequestHeader("Access-Control-Allow-Origin", '*');
xhr.setRequestHeader("Access-Control-Allow-Credentials", 'false');
xhr.setRequestHeader("Access-Control-Allow-Headers", 'X-Requested-With,Content-Type,Authorization');
xhr.setRequestHeader("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS");
xhr.setRequestHeader("Access-Control-Max-Age", '864000');
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7371
Location: Germany, Next to Hamburg

PostPosted: Tue 16 Oct '18 23:36    Post subject: Reply with quote

ajax requests fail with a 500 error if the script from the server does send 200 code. YOu might open the developer tools in your browser and look into what response you get from that script / url that you are calling.

You also should console log errorThrown
Back to top


Reply to topic   Topic: setting up apache2 with SSL on a Linux server View previous topic :: View next topic
Post new topic   Forum Index -> Coding & Scripting Corner