Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ export interface AttachOptions {
* @default 1000
*/
destroyUpgradeTimeout?: number;

/**
* Should we add a trailing slash to the path?
* @default true
*/
trailingSlash?: boolean;
}

export interface ServerOptions {
Expand Down Expand Up @@ -638,9 +644,10 @@ export class Server extends BaseServer {
let path = (options.path || "/engine.io").replace(/\/$/, "");

const destroyUpgradeTimeout = options.destroyUpgradeTimeout || 1000;
const trailingSlash = options.trailingSlash || true;

// normalize path
path += "/";
path += trailingSlash ? "/" : "";

function check(req) {
return path === req.url.slice(0, path.length);
Expand Down