Frontend Images & Theme Upload Error, No Backend Errors

Problem : I am not able to upload images or themes to the ghost blog. The permissions of nginx and ghost have been already changed to 0777 however it did not fix the issue.

If you aren’t running the latest version of Ghost, the first thing we will ask you to do is update to the latest version of Ghost.

Ghost-CLI version: 1.15.3
Ghost version: 3.41.6 (at /var/www/ghost-blog)

And

  • How was Ghost installed and configured?

I have followed the documentation instructions.

  • What Node version, database, OS & browser are you using?

node -v
v12.20.2

  • What errors or information do you see in the console?

ghost run | does not report any error.

The console

  • What steps could someone else take to reproduce the issue you’re having?

I am not sure what is the issue nor how to reproduce it.

I would appreciate any suggestions cause nothing that I tried worked.

Hey @markh0ppus ! Would help if you could get the entries in error.log when this error starts happening. The logs are usually stored in /content/logs/ folder along your Ghost installation and you can track them with something like: tail -f -n100 ./content/logs/*.log (if run from the root directory of Ghost instance, guessing it’s /var/www/ghost-blog in your case).

Hey @naz thanks for looking into it.

I believe I have already checked the logs but could not see anything obvious.

Below is the output I get when trying to upload a theme or image respectively and as said when the frontend error happens nothing is logged at the backend nor the frontend console :


{
   "name":"Log",
   "hostname":"hv1-ghost-blog",
   "pid":734832,
   "level":30,
   "req":{
      "meta":{
         "requestId":"0b10cc2c-694a-4b41-bd50-b60d75ae6b67",
         "userId":"1"
      },
      "url":"/themes/",
      "method":"GET",
      "originalUrl":"/ghost/api/v3/admin/themes/",
      "params":{
         
      },
      "headers":{
         "x-forwarded-for":"91.125.195.74, 192.168.30.2",
         "x-forwarded-proto":"https",
         "x-real-ip":"192.168.30.2",
         "host":"blog.infoitech.co.uk",
         "connection":"close",
         "user-agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0",
         "accept":"application/json, text/javascript, */*; q=0.01",
         "accept-language":"en-GB,en;q=0.5",
         "accept-encoding":"gzip, deflate, br",
         "content-type":"application/json; charset=UTF-8",
         "x-ghost-version":"3.41",
         "app-pragma":"no-cache",
         "x-requested-with":"XMLHttpRequest",
         "referer":"https://blog.infoitech.co.uk/ghost/",
         "cookie":"**REDACTED**"
      },
      "query":{
         
      }
   },
   "res":{
      "_headers":{
         "x-powered-by":"Express",
         "cache-control":"no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
         "content-type":"application/json; charset=utf-8",
         "etag":"W/\"69b-E4ng9GAVl6X3IsxOMO6pSuYL+7Q\"",
         "vary":"Accept-Encoding",
         "content-encoding":"gzip"
      },
      "statusCode":200,
      "responseTime":"21ms"
   },
   "msg":"",
   "time":"2021-03-11T14:31:38.805Z",
   "v":0
}

{
   "name":"Log",
   "hostname":"hv1-ghost-blog",
   "pid":734832,
   "level":30,
   "req":{
      "meta":{
         "requestId":"b0eee546-4a68-410a-9244-f5beec0f06c2",
         "userId":"1"
      },
      "url":"/settings/?group=site%2Ctheme%2Cprivate%2Cmembers%2Cportal%2Cnewsletter%2Cemail%2Camp%2Clabs%2Cslack%2Cunsplash%2Cviews%2Cfirstpromoter",
      "method":"GET",
      "originalUrl":"/ghost/api/v3/admin/settings/?group=site%2Ctheme%2Cprivate%2Cmembers%2Cportal%2Cnewsletter%2Cemail%2Camp%2Clabs%2Cslack%2Cunsplash%2Cviews%2Cfirstpromoter",
      "params":{
         
      },
      "headers":{
         "x-forwarded-for":"91.125.195.74, 192.168.30.2",
         "x-forwarded-proto":"https",
         "x-real-ip":"192.168.30.2",
         "host":"blog.infoitech.co.uk",
         "connection":"close",
         "user-agent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0",
         "accept":"application/json, text/javascript, */*; q=0.01",
         "accept-language":"en-GB,en;q=0.5",
         "accept-encoding":"gzip, deflate, br",
         "content-type":"application/json; charset=UTF-8",
         "x-ghost-version":"3.41",
         "app-pragma":"no-cache",
         "x-requested-with":"XMLHttpRequest",
         "referer":"https://blog.infoitech.co.uk/ghost/",
         "cookie":"**REDACTED**"
      },
      "query":{
         "group":"site,theme,private,members,portal,newsletter,email,amp,labs,slack,unsplash,views,firstpromoter"
      }
   },
   "res":{
      "_headers":{
         "x-powered-by":"Express",
         "cache-control":"no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0",
         "content-type":"application/json; charset=utf-8",
         "etag":"W/\"3574-k98PDAuYuo15fjasPAoONbD/k6k\"",
         "vary":"Accept-Encoding",
         "content-encoding":"gzip"
      },
      "statusCode":200,
      "responseTime":"29ms"
   },
   "msg":"",
   "time":"2021-03-11T14:33:25.333Z",
   "v":0
}

Let me know if you spot anything that might indicate what is the issue.

I am not sure if it might be an issue, but I have an HAproxy setup as simply illustrated below :


| pfSense + HAproxy |> Ghost-Blog |

Thanks for helping !! :grinning_face_with_smiling_eyes:

@markh0ppus both of those requests are GET requests, are you sure they correspond to the upload attempts because those would be POST requests? The /settings/* request also doesn’t match any upload endpoint.

If there are no errors in your Ghost logs then I’d suggest checking your proxy logs and double-checking that you haven’t blocked uploads/POST requests or accidentally redirected them.

2 Likes

@Kevin & @naz Thanks for your help.

Sometimes we cannot figure out the solution without looking at the problem from a different angle which you guys helped me to.

Since the ghost blog engine was not seeing the POST requests I have decided to watch what my NGINX was seeing. It was returning a 408 error :

192.168.30.2 - - [11/Mar/2021:21:36:47 +0000] "POST /ghost/api/v3/admin/images/upload/ HTTP/1.1" 408 0 "https://blog.infoitech.co.uk/ghost/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0"

Which meant that the problem was probably in the HAProxy. The HAProxy logs on the pfSense are a bit tricky and netgate recommends installing a remote Syslog server that I will eventually install in my infrastructure and temporally in order to troubleshoot I have decided to install the syslog-ng package on the pfSense itself and in the process I have noticed that not just my HAProxy package but the pfSense was one version behind and after upgrading my pfSense the HAProxy package got upgraded too and voila :fireworks: everything is working.

The conclusion is that the HAProxy had a :bug: !!

This discussion can be closed and thanks for the help.

1 Like