phpsymfonyswagger-uiapi-platform.com

How to set HTTP as default scheme in API Platform Swagger UI?


I am building a web app using Symfony v4.3 and API Platform.

API Platform has OpenAPI documentation (Swagger UI) and every time I go to myweb_url/api/doc UI, scheme is set to HTTPS as default. I would like to configure it to HTTP as default scheme in api_platform.yaml config file.

Is this even the right place to do this and is this possible without decorating the whole UI?


Solution

  • The answer is nelmio_api_doc.yaml configuration

    To achieve HTTP as default in api/doc, you need to put HTTP first in the scheme field in the nelmio_api_doc.yaml configuration:

    nelmio_api_doc:
    
    documentation:
        schemes: [http, https]