Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED] Proper HTTP response for PNG  (Read 1020 times)
0 Members and 1 Guest are viewing this topic.
Offline kingroka123
« Posted 2018-06-25 21:05:54 »


I've been doing some work with backend java server programming (and progressive apps) and I have gotten to the point where I am deploying to Heroku. The problem is none of my icons are loading despite them loading in a local testing environment. Heroku is throwing an error code of H17 which I looked up and says that it has to do with the formatting of my HTTP response. The thing is my entire page loads perfectly except for the icons. I was wondering if anybody else has had an issue similar to this.

Http response format:
HTTP/1.1 200 OK
Content-Type: image/png
Connection: close

*raw image data*

this response works in a local environment (chrome: desktop and mobile)

full error
http_error="Invalid HTTP status line" 
at=error code=H17
desc="Poorly formatted HTTP response"
fwd="*some ipv4 adress*"
connect=0ms service=2ms status=503 bytes=2482 protocol=https
Offline CommanderKeith
« Reply #1 - Posted 2018-06-26 01:18:56 »

I haven't had your specific problem, but when I put my jsp web application on a server, missing mime types on the server caused errors that didn't appear in my local machine.
How are you hosting the web app? In a tomcat server instance?

Offline kingroka123
« Reply #2 - Posted 2018-06-26 03:41:03 »

I'm not using any libraries or anything. Just using the package with FreeMarker as a template engine.

In terms of mime types, my server can output text/* and the image/* types. and can handle get, post, put, and delete requests. I assumed this would at least be enough for testing and that I could add additional features as I need them.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline CommanderKeith
« Reply #3 - Posted 2018-06-26 04:37:05 »

Ok, well that sounds fine. Given that you problem only happens with PNG images, sounds like something's wrong with your raw image data or the way it's sent. I'd investigate the way Heroku send the raw image data and copy the way they do it.

It may be that Heroku has some annoying arbitrary restriction, so maybe try another host to see if the same error comes up.

Could also be worth trying other image formats such as JPEGs and see if that works.

Offline kingroka123
« Reply #4 - Posted 2018-06-26 18:58:21 »

Ok, so I fixed it. It seems you were half correct. While my header was valid and the way I was loading and sending image data was correct, I was sending the header as plain text and the image data as raw bytes. So Heroku didn't know what to do and just stopped the connection altogether. Thanks!
Pages: [1]
  ignore  |  Print  

hadezbladez (1143 views)
2018-11-16 13:46:03

hadezbladez (515 views)
2018-11-16 13:41:33

hadezbladez (1177 views)
2018-11-16 13:35:35

hadezbladez (262 views)
2018-11-16 13:32:03

EgonOlsen (2556 views)
2018-06-10 19:43:48

EgonOlsen (2776 views)
2018-06-10 19:43:44

EgonOlsen (1557 views)
2018-06-10 19:43:20

DesertCoockie (2260 views)
2018-05-13 18:23:11

nelsongames (2110 views)
2018-04-24 18:15:36

nelsongames (2804 views)
2018-04-24 18:14:32
Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!