Giter Club home page Giter Club logo

Comments (3)

doramatadora avatar doramatadora commented on July 27, 2024 1

Hi @aivong3, I'll close this issue now, noting that the behaviour is limited to non-RFC3986 compliant paths.

from expressly.

doramatadora avatar doramatadora commented on July 27, 2024

Hi @aivong3,

This looks like a runtime issue, rather than an expressly issue.

Taking the following Compute application, which should return OK (HTTP 200) on any route, and running curl -svo /dev/null "http://127.0.0.1:7676/<", produces the same 400 Bad Request response:

/// <reference types="@fastly/js-compute" />

addEventListener("fetch", (event) => event.respondWith(handleRequest(event)));

async function handleRequest(event) {
  console.log(`Request received in Compute: ${event.request.method} ${event.request.url}`)
  return new Response("OK", { status: 200 });
}

I am therefore redirecting this issue to the runtime team – CC @JakeChampion

I suspect it's something to do with the < (non-RFC3986 compliant path) in particular.

Running the following:

curl -svo /dev/null  "http://127.0.0.1:7676/not-a-route"
curl -svo /dev/null  "https://quickly-sure-caribou.edgecompute.app/not-a-route"

In expressly:

import { Router } from "@fastly/expressly";

const router = new Router();

router.use((req, res) => {
  console.log(`Request received: ${req.method} ${req.url}`);
});

router.get("/", async (req, res) => {
  return res.send("Hello world!");
});

router.use((err, req, res) => {
  console.error(err);
  res.withStatus(500).send(`Uh-oh! Something went wrong: ${err.message}`);
});

router.listen();

Results in the expected logs and 500 error.

from expressly.

aivong3 avatar aivong3 commented on July 27, 2024

Hi @doramatadora,

Thanks for taking a look! It would be nice to have the flexibility to handle these bad requests in a custom way like we can for the other errors. Will see if this is possible with the runtime team

from expressly.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.