dherault / dherault/serverless-offline

Stripping trailing slashes breaks django admin

Open
#1,744 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
811
Avg merge
2d 4h
Merged PRs (30d)
3

Description

## Bug Report

**Current Behavior**

serverless-offline strips trailing slashes from URL, so accessing `http://localhost:8000/admin/` in the browser translates into `http://localhost:8000/admin` for the backend that is running with serverless-offline.

**Expected behavior/code**

URLs ending with slash should have the slash on backend and URLs without shouldn't have. In other words, serverless-offline shouldn't add or remove trailing slash. Or at least there should be an option for this behaviour.

**Environment**

- `serverless` version: 3.2.0
- `serverless-offline` version: 13.3.0
- `node.js` version: v20.9.0
- `OS`: Fedora 39

_optional, if you are using any of the following frameworks to invoke handlers_

- `python` version: v3.9.18
- `django` version: 4.2

**Possible Solution**

Add an option for this.

**Additional context/Screenshots**

There was `noStripTrailingSlashInUrl` in older versions of serverless-offline but it got removed. I have no idea what was the reason: https://github.com/dherault/serverless-offline/commit/71ee21db253f601f5355377e1a67d641fc447bea

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.