fixes problems with html format and when server variable doesn't include HTTP_ORIGIN