2

I've been trying to run a CGI script on heroku with no luck.

I've followed the suggestion in this response:

Run Python CGI Application on Heroku

(by editing the procfile to run a python CGI server), but I get an H18 error from the heroku logs. Here is the error:

2015-12-07T00:33:49.452384+00:00 heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/cgi-bin/dilaps.cgi" host=blooming-beyond-1824.herokuapp.com request_id=a53e612c-1148-4f62-93fe-737aaee5af1d fwd="58.96.22.170" dyno=web.1 connect=1ms service=1170ms status=503 bytes=11383

What exactly does it mean and how can I go about fixing it? No other errors occur.

Here is my directory structure in case it's relevant.

Procfile
jobs -> *txt files
setup.py
cgi-bin -> dilaps.cgi
js -> *js files
css -> *css files
requirements.txt
Community
  • 1
  • 1
Chris
  • 21
  • 3

1 Answers1

0

Here's one problem I ran into: Heroku's HTTP router is strict about carriage returns in the headers, while my browser is lenient. So my scripts worked during testing, but not on Heroku.

So this script worked:

#!/bin/sh
printf 'Content-Type: text/plain\r\n'
printf '\r\n'
echo "hello world"

... and this script failed with H18:

#!/bin/sh
echo "Content-Type: text/plain"
echo
echo "hello world"
guest
  • 6,450
  • 30
  • 44