Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined index: HTTP_HOST #68

Closed
fabbrikk opened this issue Aug 13, 2015 · 5 comments
Closed

Undefined index: HTTP_HOST #68

fabbrikk opened this issue Aug 13, 2015 · 5 comments

Comments

@fabbrikk
Copy link

When, for some reasons ,the variable $_SERVER['HTTP_HOST'] is null, this file generate an error
Uncaught exception 'ErrorException' with message 'Undefined index: HTTP_HOST' in
vendor/bugsnag/bugsnag/src/Bugsnag/Request.php on row 74,

return $schema.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];

I changed it to:

$host = array_key_exists( 'HTTP_HOST', $_SERVER) ? $_SERVER['HTTP_HOST'] : gethostbyaddr($_SERVER["REMOTE_ADDR"]);
return $schema.$host.$_SERVER['REQUEST_URI'];

It's correct or I'm missing something? Why this can happen?

@GrahamCampbell
Copy link
Contributor

Under what conditions does this happen please? Are you running a console app?

@GrahamCampbell
Copy link
Contributor

Could you var_dump($_SERVER) for me please?

@fabbrikk
Copy link
Author

Sorry but I changed from BugSnag to Sentry. I'll try again BugSnag later this year.

@mverma16
Copy link

@GrahamCampbell
please help we are getting these erros.
1

2

Stack-trace shows bugsnag package's files, can you help to solve it, Please reply here or I have to open a new issue.

@GrahamCampbell
Copy link
Contributor

GrahamCampbell commented Jul 11, 2016

Thanks for getting in touch. A handshake timeout is something we can't do anything about. It means your server failed to complete the SSL negotiation in time. You could turn off SSL if you're having problems with this. In your bugsnag config file, set the endpoint to Bugsnag_Configuration::$DEFAULT_NON_SSL_ENDPOINT.

The fact that this error is crashing your application is not desirable though. We should be logging the failed request, and continuing. I'll create a new issue regarding this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants