These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

HTTP Headers

Author
Coryigon
Mom 'n' Pop Ammo Shoppe
#1 - 2013-06-18 23:12:15 UTC
So, I run maintain a website for my corp for the last 5 years or so, and today, all header info is no longer being passed to the browser, I have put up a test page on a different server ( same host ) with no luck. Not getting any information even while the site is trusted. Has anyone else had an issue like this or know anything that might help me?
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#2 - 2013-06-18 23:23:49 UTC
You're probably using nginx or apache 2.4, which are sanitizing the headers,.

If you're using PHP, take a look at using http://php.net/manual/en/function.apache-request-headers.php

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Draugo Rana
Masuat'aa Matari
Ushra'Khan
#3 - 2013-06-19 11:52:15 UTC

Which headers? Request headers or response headers? Where do you look for these headers and how?

Also, providing more information about the server OS, web server, server side scripting framework (PHP?), browser, etc will help you get more relevant answers.
Coryigon
Mom 'n' Pop Ammo Shoppe
#4 - 2013-06-19 15:32:29 UTC
It is GoDaddy hosting, on a linux box with php 5.3, the code has been working up until yesterday. Yesterday it just decided to stop working I am trying to find out why here is an example of what returns blank headers.

echo $_SERVER['HTTP_USER_AGENT'];
echo $_SERVER['HTTP_EVE_TRUSTED'];
echo $_SERVER['HTTP_EVE_SOLARSYSTEMNAME'];
echo $_SERVER['HTTP_EVE_CHARNAME'];
echo $_SERVER['HTTP_EVE_ALLIANCENAME'];
echo $_SERVER['HTTP_EVE_SHIPTYPENAME'];
echo $_SERVER['HTTP_EVE_CHARID'];
echo $_SERVER['HTTP_EVE_CORPNAME'];
echo $_SERVER['HTTP_EVE_CORPID'];
echo $_SERVER['HTTP_EVE_REGIONNAME'];
echo $_SERVER['HTTP_EVE_STATIONNAME'];

The only one returning any data is the user agent, but yesterday even that was returning blank.
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#5 - 2013-06-19 15:41:01 UTC
GoDaddy have probably updated the webserver.

try:

$headers = apache_request_headers();
echo $headers['HTTP_EVE_CHARID'];

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Coryigon
Mom 'n' Pop Ammo Shoppe
#6 - 2013-06-19 15:54:35 UTC
Fatal error: Call to undefined function apache_request_headers()
Manhim
Garoun Investment Bank
Gallente Federation
#7 - 2013-06-19 16:17:00 UTC
Try with http_get_request_headers()

From the comments on the PHP page: "Keep in mind that this function replaces all "_" characters by "-" in headers names".
Coryigon
Mom 'n' Pop Ammo Shoppe
#8 - 2013-06-19 16:23:38 UTC
Fatal error: Call to undefined function http_get_request_headers()
Manhim
Garoun Investment Bank
Gallente Federation
#9 - 2013-06-19 16:35:02 UTC
Well, all I can say is that GoDaddy offers crap hosting. I would've proposed to host you on my server, but I usually host enterprise-level and not really small customers.
Coryigon
Mom 'n' Pop Ammo Shoppe
#10 - 2013-06-19 17:03:37 UTC
Well like I said its always worked until yesterday, they changed something I am trying to find out what with their support.
Coryigon
Mom 'n' Pop Ammo Shoppe
#11 - 2013-06-19 20:05:07 UTC
Ok, they have upgraded to apache 2.4 aparently, now what can I do to get these headers back?
Draugo Rana
Masuat'aa Matari
Ushra'Khan
#12 - 2013-06-19 21:29:05 UTC  |  Edited by: Draugo Rana
Coryigon wrote:
Ok, they have upgraded to apache 2.4 aparently, now what can I do to get these headers back?


Take a look at the link that was provided earlier:
http://php.net/manual/en/function.apache-request-headers.php

According to the docs this function exists if PHP is running as an Apache module or if it's PHP 5.4.0 or above. It is probably neither in your case (output phpinfo() to make sure)

Another solution could be to change Apache config to allow these headers (they are not allowed by default in Apache 2.4 because of the underscores in them, blame CCP for using not supported header characters). But you probably don't have access to Apache config in shared hosting.


Best solution overall - ditch GoDaddy, nobody should voluntarily use them anyway.
Ultran
The Local Co.
#13 - 2013-08-01 20:14:45 UTC  |  Edited by: Ultran
That makes me sad. I'm running into the same challenges today on shared Linux GoDaddy hosting while building a new web tool.

It's definitely not GoDaddy's fault for keeping their servers up-to-date.

Now to see if there's a work-around somewhere...

Pirate
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#14 - 2013-08-01 20:27:04 UTC
Ultran wrote:
That makes me sad. I'm running into the same challenges today on shared Linux GoDaddy hosting while building a new web tool.

It's definitely not GoDaddy's fault for keeping their servers up-to-date.

Now to see if there's a work-around somewhere...

Pirate



As long as it's an embedded php, then apache_request_headers() is your friend here.

http://pastebin.com/Tmd3i4V3 is an example of how to use it. First printing all the headers, then just the EVE_TRUSTED header

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Ultran
The Local Co.
#15 - 2013-08-01 20:34:55 UTC
Here's the challenge:

Quote:
Fatal error: Call to undefined function apache_request_headers()


It works great in my local test environment. If I call any of the apache related functions in my shared hosting, it gets mad. :(

If I print all my headers, all the EVE ones are missing:

Quote:
print_r($_SERVER);
Steve Ronuken
Fuzzwork Enterprises
Vote Steve Ronuken for CSM
#16 - 2013-08-01 20:43:45 UTC
Ultran wrote:
Here's the challenge:

Quote:
Fatal error: Call to undefined function apache_request_headers()


It works great in my local test environment. If I call any of the apache related functions in my shared hosting, it gets mad. :(

If I print all my headers, all the EVE ones are missing:

Quote:
print_r($_SERVER);



apache_request_headers depends on php being built into apache. If it's being managed through something like like fastcgi, through PHP FPM, it's not available, and you'll get that kind of error. Which means, unfortunately, you're out of luck. They're not available to you.


If you have access to .htaccess, you may be able to use https://httpd.apache.org/docs/trunk/env.html#fixheader

Woo! CSM XI!

Fuzzwork Enterprises

Twitter: @fuzzysteve on Twitter

Ultran
The Local Co.
#17 - 2013-08-01 21:03:00 UTC
Quote:
If you have access to .htaccess, you may be able to use https://httpd.apache.org/docs/trunk/env.html#fixheader


Steve,
Thanks for the feedback. I haven't had success with the .htaccess option yet, but I gave you a "like" anyway as it opened a new door of clues to look into. I'll post if I can get something working. :)
Ultran
The Local Co.
#18 - 2013-08-01 22:17:28 UTC  |  Edited by: Ultran
==========
SOLUTION!!
==========

If you are on GoDaddy shared hosting with Apache 2.4+ (or maybe some other shared solution with .htaccess support and mod_setenvif enabled and Apache 2.4+ and apache_request_headers() useless), here's how to make things normal* again so that you can access in-game variables with $_SERVER['HTTP_EVE_CHARNAME'], etc.:

Create a .htaccess file or add this to the top of your existing .htaccess file, placed in the root directory or same folder where all the EVE action happens on your site:

Quote:
SetEnvIfNoCase EVE_TRUSTED "(.*)" HTTP_EVE_TRUSTED=$1
SetEnvIfNoCase EVE_SERVERIP "(.*)" HTTP_EVE_SERVERIP=$1
SetEnvIfNoCase EVE_CHARNAME "(.*)" HTTP_EVE_CHARNAME=$1
SetEnvIfNoCase EVE_CHARID "(.*)" HTTP_EVE_CHARID=$1
SetEnvIfNoCase EVE_CORPNAME "(.*)" HTTP_EVE_CORPNAME=$1
SetEnvIfNoCase EVE_CORPID "(.*)" HTTP_EVE_CORPID=$1
SetEnvIfNoCase EVE_ALLIANCENAME "(.*)" HTTP_EVE_ALLIANCENAME=$1
SetEnvIfNoCase EVE_ALLIANCEID "(.*)" HTTP_EVE_ALLIANCEID=$1
SetEnvIfNoCase EVE_REGIONNAME "(.*)" HTTP_EVE_REGIONNAME=$1
SetEnvIfNoCase EVE_CONSTELLATIONNAME "(.*)" HTTP_EVE_CONSTELLATIONNAME=$1
SetEnvIfNoCase EVE_SOLARSYSTEMNAME "(.*)" HTTP_EVE_SOLARSYSTEMNAME=$1
SetEnvIfNoCase EVE_STATIONNAME "(.*)" HTTP_EVE_STATIONNAME=$1
SetEnvIfNoCase EVE_STATIONID "(.*)" HTTP_EVE_STATIONID=$1
SetEnvIfNoCase EVE_CORPROLE "(.*)" HTTP_EVE_CORPROLE=$1
SetEnvIfNoCase EVE_SOLARSYSTEMID "(.*)" HTTP_EVE_SOLARSYSTEMID=$1
SetEnvIfNoCase EVE_WARFACTIONID "(.*)" HTTP_EVE_WARFACTIONID=$1
SetEnvIfNoCase EVE_SHIPID "(.*)" HTTP_EVE_SHIPID=$1
SetEnvIfNoCase EVE_SHIPNAME "(.*)" HTTP_EVE_SHIPNAME=$1
SetEnvIfNoCase EVE_SHIPTYPEID "(.*)" HTTP_EVE_SHIPTYPEID=$1
SetEnvIfNoCase EVE_SHIPTYPENAME "(.*)" HTTP_EVE_SHIPTYPENAME=$1

Those headers exist, but get stripped by Apache 2.4+ for security reasons because Eve Online in-game headers are invalid with the underscores (Bad CCP! Bad! Use "-" instead of "_"). Blink

*normal: With this .htaccess in place, all server variables like $_SERVER['HTTP_EVE_CHARNAME'] will always exist, but will always be blank or null if not trusted.

Example PHP Usage:
Quote:
if($_SERVER['HTTP_EVE_TRUSTED'] == "Yes") {
//The browser indicates capsuleer trust, and everything is as usual...
}



I feel kind of left out with 0 likes. Can I get a like if that helps? Roll