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

**URL:** <https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986>\
**Category:** Routing\
**Created:** [September 10, 2018, 4:20pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986 "2018-09-10T16:20:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![marc](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@marc](https://forum.ghost.org/u/marc)\
**Post date:** [September 10, 2018, 4:20pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/1 "2018-09-10T16:20:08Z")

</div>

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](https://forum.ghost.org/t/how-to-create-multilanguage-posts/2537/8). @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?

Thanks,  
Marc

---

<div class="post-metadata">

**Author:** ![John](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/john/32/29288_2.png) [@John](https://forum.ghost.org/u/John)\
**Post date:** [September 10, 2018, 4:23pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/2 "2018-09-10T16:23:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [September 10, 2018, 4:38pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/3 "2018-09-10T16:38:24Z")

</div>

@marc

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.

---

<div class="post-metadata">

**Author:** ![marc](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@marc](https://forum.ghost.org/u/marc)\
**Post date:** [September 10, 2018, 4:54pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/4 "2018-09-10T16:54:55Z")

</div>

@Kate

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.

---

<div class="post-metadata">

**Author:** ![vikaspotluri123](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/vikaspotluri123/32/24_2.png) [@vikaspotluri123](https://forum.ghost.org/u/vikaspotluri123)\
**Post date:** [September 10, 2018, 5:01pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/5 "2018-09-10T17:01:22Z")

</div>

> [@marc](#):
>
> 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?

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

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [September 10, 2018, 5:18pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/6 "2018-09-10T17:18:36Z")

</div>

@marc

Can you look at the request payload?

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

```

---

<div class="post-metadata">

**Author:** ![marc](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@marc](https://forum.ghost.org/u/marc)\
**Post date:** [September 10, 2018, 5:23pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/7 "2018-09-10T17:23:47Z")

</div>

@Kate Edit: Found it:

> -----------------------------9025189121765679086983847821  
> Content-Disposition: form-data; name=“routes”; filename=“routes.yaml”  
> Content-Type: application/x-yaml
> 
> routes:
> 
> collections:  
> /:  
> permalink: /{slug}/  
> template:  
> - index
> 
> taxonomies:  
> tag: /tag/{slug}/  
> author: /author/{slug}/
> 
> -----------------------------9025189121765679086983847821–

@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!

---

<div class="post-metadata">

**Author:** ![Kate](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/kate/32/35_2.png) [@Kate](https://forum.ghost.org/u/Kate)\
**Post date:** [September 10, 2018, 6:05pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/8 "2018-09-10T18:05:42Z")

</div>

> [@marc](#):
>
> application/x-yaml

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

> <https://github.com/TryGhost/Ghost/commit/ec49a48a1ee77aae8c23e0f83493b3363a917234>
>
> no issue
> 
> \- a specific content type was missing (e.g. Firefox on Ubuntu)
> \- they …send a different content-type to the server: application/x-yaml
> \- was reported in the forum: https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986

---

<div class="post-metadata">

**Author:** ![marc](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@marc](https://forum.ghost.org/u/marc)\
**Post date:** [September 10, 2018, 6:08pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/9 "2018-09-10T18:08:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![marc](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@marc](https://forum.ghost.org/u/marc)\
**Post date:** [September 17, 2018, 6:18pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/10 "2018-09-17T18:18:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex015/uploads/ghost2/original/2X/b/ba9ce5100b8bb264586f4f572545596b2ce3f081.png) [@system](https://forum.ghost.org/u/system)\
**Post date:** [October 1, 2018, 6:18pm UTC](https://forum.ghost.org/t/cant-upload-routes-yamls-for-dynamic-routing-error-please-select-a-valid-yaml-file-to-import/2986/11 "2018-10-01T18:18:29Z")

</div>

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