Can't upload routes.yamls for dynamic routing. Error "Please select a valid YAML file to import."

My setup is as follows:

  • Ubuntu/Linux server (16.04)
  • Ghost-CLI version 1.9.2
  • Ghost version 2.1.1
  • I use Firefox on Ubuntu, but tried Chromium as well as the Ghost-desktop app for Ubuntu
  • No special configuration I believe

I wanted to change the routes.yaml file in order to have a static home page, but every time I upload a routes.yaml file (exactly named that), I get the error “Please select a valid YAML file to import”. Another user had (has?) apparently a similar problem with respect to multi-language support. @Kate and @Hannah suggested that it is a problem with linux (the serverside, I assume) missing some YAML content type…

I tried to do ‘npm install yaml’ on my server, but it doesn’t change anything. I did so, assuming that (i) Ghost uses npm to do checks on routes.yaml; (ii) that the missing package is the node yaml package. There are other yaml packages for node though.

My question: What can/should I do to install all the YAML content types on my linux server?


I believe the suggestion is that it might be due to Ubuntu on your local computer not applying a content type, rather than the server. It definitely works on the server.


If you open the developer tools in Firefox and record the upload request, you can see which Content-Type header is sent to the server.


If I understand you correctly, you mean the Content-Type of the HTTP request? If so, it is

Content-Type: multipart/form-data; boundary=---------------------------… (some numbers)

And yes, I get a 415 error, which is an Unsupported Media error.

So, if I understand correctly, other browsers on other platforms submit this as (say) Content-Type: YAML, and all would be good. What can I do on Ubuntu to get around this?

Having said that, I updated the content/settings/routes.yaml file on the server directly, and it didn’t have an effect (although that may have been a caching issue, since I changed it and went to the homepage). Is that the right place to edit the routes.yaml file?

Thanks for the superquick response.

If you change the routes.yml file, you need to restart your ghost instance for the changes to take effect

1 Like


Can you look at the request payload?

Content-Disposition: form-data; name="routes"; filename="routes.yaml"
Content-Type: application/octet-stream

@Kate Edit: Found it:

Content-Disposition: form-data; name=“routes”; filename=“routes.yaml”
Content-Type: application/x-yaml


permalink: /{slug}/
- index

tag: /tag/{slug}/
author: /author/{slug}/


@vikaspotluri123 That turns out to work (although my configuration is all wrong it seems, and interating this process won’t be fun - but it’s possible). Thanks!

Here we go. This content type is currently not accepted by the Ghost server.
I just pushed this fix, will be released tomorrow :slight_smile:

1 Like

Great, I will try it tomorrow (or the day after, since I am on GMT) and let you know if it works.

I’ve installed the new ghost, and uploading routes.yaml worked right away. Thanks @Kate

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.