First web app

I created a simple web app just to test if my hosting can handle the cgi. I enabled cgi-bin, created the linux 64bit cgi app, uploaded to cgi-bin and it works.

I read this article to make the upgrade process easier (I plan to make this cgi app better).

To test the process to upgrade, I renamed the app.cgi to app2.cgi and after a few seconds I got “The application has gone off-line. Please try again later.” message. I renamed back the app2.cgi to app.cgi, reloaded the page and everything works as normal.

After that I looked at the apache/nginx logs. I re-did the test and when when I get the warning about the application has gone off-line, I see this:

IP Date-Time "GET /cgi-bin/xojo/ping HTTP/1.1" 404 307 "http://mysite/cgi-bin/app.cgi" Mozilla/5.0 (Macintosh... Firefox/58.0"


IP Date-Time "GET /cgi-bin/xojo/ping HTTP/1.0" 404 390


Date Time [cgid:error] ... AH01264: script not found or unable to stat: ../cgi-bin/xojo, referer: http://mysite/cgi-bin/app.cgi

every few seconds.

At this time I have 3 log files, creating a new line every 5 seconds because I have Firefox at the off-line page. I guess if more browsers/computers were open and left at that page the logs could grow very fast.

I don’t know much (not even a little) about Xojo web apps, but it looks like the browser, after going the service off-line, started trying to execute other script on the server that is not there. At least that’s how it looks to me because it reports the request as Firefox.

So my question is why is this happening? Shouldn’t the browser stop communicating with the server (waiting for a manual refresh) or at least try to reconnect to the app.cgi?

My experience is that if you leave the browser loaded with that URL (even with the “gone offline” message), it will continue to try to start the CGI app. So I don’t think the session dies just because you renamed the CGI file (with Phillip Zedalis’ kill code timer working for you), which leads to the browser continuing to try to hit the Web app. At least it seems to do that for a long time.

What Phillip’s code allows you to do is upgrade your CGI file without fearing an Internal Server Error 500 occurring when you attempt that. That’s why I use it with every Xojo Web (CGI) app.

Thank you Ralph.

That’s exactly what I expect, if I keep the browser open at the off-line message, to keep trying to reconnect to the app. But the logs show that the browser is trying to run /cgi-bin/xojo/ping and that’s is why I get those lines with error 404 (that’s what I think and the error doesn’t show on the browser, it just keeps the off-line message).

This are the steps:

  • point browser to mysite/cgi-bin/app.cgi
  • rename app.cgi to app2.cgi
  • web app goes off-line
  • I start getting the log information
  • rename back app2.cgi to app.cgi (to simulate an upgrade)
    at this point I expected the web app to reload on its own. A manual refresh on the browser works ok. The log information about /cgi-bin/xojo/ping stop at this point (once the app is online again).

This is expected behavior. The “ping” requests are the browsers checking to see if the web application has come back online or not. They’ll give up after a bit.

Thank you Greg. Can you explain a little bit more?

What I’m seeing is this: I have an app in /cgi-bin/app.cgi, I rename the app to app2.cgi and it goes off-line, then I start getting the “ping” but the browser is asking for a script in /cgi-bin/xojo/ping but I don’t have that file. When I rename app2.cgi to app.cgi the browser doesn’t reload the page/app. Why the browser is trying to find a script in /cgi-bin/xojo?

I’m going to test again to find out how long it takes to give up.

This is what I did:

  • connect with Firefox to the app.cgi
  • rename app.cgi
  • app went off-line
  • start getting info into logs
  • rename app back to app.cgi

After 30 minutes:

  • Firefox still show the off-line info
  • I still get in error.log “script not found /cgi-bin/xojo” every 5 seconds

My guess:

  • the error.log will continue to get new info as long as I keep Firefox in that page
  • if I reload the page I will be able to work with the app again and the error.log will stop receiving this messages

What I expect:

  • the browser try to reload the app
  • do not try to execute a script in /cgi-bin/xojo (because there is not one there)

@Greg O’Lone is this the expected behavior or I’m missing some files in my cgi-bin directory?

You aren’t missing anything. The pings should be going to /cgi-bin/app.cgi/xojo/ping. Please check the url and if it doesn’t have the name of the cgi file in there, that’s a bug that we’ll have to get fixed.