Skip to content

plugin config routePrefix breaks the page #165

Closed
@blue86321

Description

@blue86321

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.28.1

Plugin version

4.0.1

Node.js version

20.x

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

14.5

Description

When we config the routePrefix parameter like below

import { fastifySwaggerUi } from "@fastify/swagger-ui";
fastify.register(fastifySwaggerUi, { routePrefix: "/api/docs" })
  • It breaks the documentation page as the css/js resource double the api prefix.
    image

  • The resource can be visited by manually twisting the url
    image

  • Removing the routePrefix, the documentation can be rendered correctly
    image

Link to code that reproduces the bug

No response

Expected Behavior

The documentation page should be rendered correctly even with routePrefix config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions