Skip to content

Reverse proxy configuration #7

@lucasoares

Description

@lucasoares

I'm using swag with fiber but I can't configure correctly the swagger definition to access the documentation behind a reverse proxy or multiple accesses.

In my use case I have three ways of accessing applications' documentation:

  1. From the proxy using a custom host and path. Example: https://my-proxy/custom/path/swag/index.html
  2. From the pod's direct IP. Example: http://123.123.1.2/swag/index.html
  3. From a port forwarding, which basically follows the same rule of 2.

The problem: I can't make basePath dynamic. It will always have one single value. And because of that the Try it out button may only work from one of those access.

Would be nice to have in swag's implementation a way of adding a prefix to the basePath in the swag.ReadDoc() call (or a new one).

If this is implemented I will be able to change the implementation of gofiber's swagger to use the X-Forwarded-Prefix header as prefix for the basePath using swag.

Thanks.

Openning by requested in swaggo/swag#1210

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