Skip to content

Having a +server.js file caused 405  #11794

@msavin

Description

@msavin

Describe the bug

I had an on-going issue with meta-tags not rendering on social platforms, as well as possible indexing problems.

One of my pages was returning 405- even though there was nothing unusual about it.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head>
<body><p>GET method not allowed</p></body>
</html>

For example:

https://colorschemer.com/schemes returns 405
https://colorschemer.com/schemes/red worked fine

I was using Facebook debugger to test changes

I ended up trying different deployment solutions, going in circles with configurations, and playing with rendering options. In the end, the problem was just the presence of the +server.js file

Directory structure was:

  • /schemes
    • [slug]
    • +server.js
    • layout, page, etc

The file had

// export const prerender = true;
// export const ssr = true;

I would try uncommenting one at at time, but ultimately, just removing it fixed the problem

Reproduction

Put an empty +server.js file, deploy and test with Facebook debugger

Logs

No response

System Info

Netlify build

Severity

annoyance

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeneeds-decisionNot sure if we want to do this yet, also design work needed

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions