LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-20-2019, 09:18 AM   #1
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Rep: Reputation: Disabled
Apache server displays ascii like headers until you refresh.


I have a webserver that when you first load the page in any brower you get an ascii like characters. Once you reload it is fine unless you open it in a new tab. This happens on all browsers.

When you look at the code it is replacing this section:

<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8" />
<meta http-equiv="ImageToolbar" content="false" />
<meta name="google-site-verification" content="vxwfJngqcuxRLZV58ZE38_-_fgcEf3eCqy5aMIp8oGA" />
<meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,initial-scale=1.0" />

As well as some js and css below it.

It is running apache 2.4.6 behind haproxy.

outside of the head the body is fine, short of js functions not working correctly because they are not loaded.

Can anyone help me figure out why this is happening?
Attached Thumbnails
Click image for larger version

Name:	malformed header.png
Views:	27
Size:	39.0 KB
ID:	29871  

Last edited by thaylin; 02-20-2019 at 09:30 AM.
 
Old 02-20-2019, 10:03 AM   #2
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Oddly when I go to the node directly bypassing haproxy the special characters are never there.
 
Old 02-20-2019, 10:46 AM   #3
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Is this a static page?

Is the indicated code at the beginning of the page? Perhaps post the first 10 lines or so of the document?

Last edited by scasey; 02-20-2019 at 10:47 AM.
 
Old 02-20-2019, 11:05 AM   #4
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
Is this a static page?

Is the indicated code at the beginning of the page? Perhaps post the first 10 lines or so of the document?
It is static header file on a dynamic page. It is the entirety of an included header, from start to finish. The header is being pulled from a drupal themes folder, but the location itself is not in drupal.
 
Old 02-20-2019, 11:31 AM   #5
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
It is added like this:

<!--#include virtual="/sites/all/themes/lib_foundation/templates/includes/head.html" -->
 
Old 02-20-2019, 11:37 AM   #6
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by thaylin View Post
It is static header file on a dynamic page. It is the entirety of an included header, from start to finish. The header is being pulled from a drupal themes folder, but the location itself is not in drupal.
Then my guess is that whatever is sending the page is not sending the requisite header...
Code:
Content-type: text/html

<html>
<head> 
...etc.
...or since it works sometimes, not sending it consistently.
Note that the blank line following the Content-type is also required. That line is often coded in a cgi script as
Code:
Content-type: text/html\n\n
 
Old 02-20-2019, 11:49 AM   #7
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Thank you for the reply. It is only an issue on the first load of the page, and always an issue on the first load of the page, once the browser has a cache it works fine.
 
Old 02-20-2019, 12:28 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by thaylin View Post
Thank you for the reply. It is only an issue on the first load of the page, and always an issue on the first load of the page, once the browser has a cache it works fine.
You may try the mod_proxy_html and see if it helps in your case.
 
Old 02-20-2019, 12:38 PM   #9
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
You may try the mod_proxy_html and see if it helps in your case.
I am sorry but I miss your meaning. Haproxy does the proxying for the server, the header is accessible via the web through haproxy and on the back end to the server. Here is the interesting bit though, if you call the header file directly, outside of the<!--#include virtual=> tags it loads fine through the proxy server or locally every time, but once you add it to a php file, any php file (and only php files) it then decides to throw out all the special characters.
 
Old 02-20-2019, 01:33 PM   #10
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
I was able to fix it, at least temporarily by deleting the httpd cache on the server. I am still not sure why I only saw the issue through haproxy but it is cleared for now. Time to just dig into the root cause.
 
Old 02-20-2019, 01:36 PM   #11
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by thaylin View Post
I am sorry but I miss your meaning. Haproxy does the proxying for the server, the header is accessible via the web through haproxy and on the back end to the server. Here is the interesting bit though, if you call the header file directly, outside of the<!--#include virtual=> tags it loads fine through the proxy server or locally every time, but once you add it to a php file, any php file (and only php files) it then decides to throw out all the special characters.
I missed the haproxy stuff, sorry.
IIRC you should use the following syntax if you want to include a html file inside a php file:
Code:
<?php include('/sites/all/themes/lib_foundation/templates/includes/head.html'); ?>
 
Old 02-28-2019, 01:37 PM   #12
sbaynes
LQ Newbie
 
Registered: Oct 2014
Posts: 28

Rep: Reputation: Disabled
Quote:
Originally Posted by thaylin View Post
I was able to fix it, at least temporarily by deleting the httpd cache on the server. I am still not sure why I only saw the issue through haproxy but it is cleared for now. Time to just dig into the root cause.
Sounds a bit like like a corrupted cache entry.
 
Old 02-28-2019, 01:40 PM   #13
thaylin
LQ Newbie
 
Registered: Oct 2015
Posts: 22

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by sbaynes View Post
Sounds a bit like like a corrupted cache entry.
yes there is a bug in apache that seems to be fixed in 2.5 that has a chance of corrupting SSI files when they are compressed.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[bash] ASCII to HEX and hex to ascii ////// Programming 17 05-08-2018 09:55 PM
[SOLVED] What is the difference between "ASCII English text" and "ASCII text" ??? astanton Slackware 13 08-05-2011 06:14 AM
[SOLVED] less displays binary but cat displays ascii? ahtoot Linux - Newbie 3 01-25-2011 08:38 PM
hex to ascii and ascii to hex ilnli Programming 7 08-31-2007 11:55 AM
Apache server: Displays site correctly first time, than source on refresh. skidrash Linux - Networking 10 09-29-2004 12:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration