Skip to content

Both HTTP and HTTPS ports cannot be specified #214

Closed

Description

@prantlf

I have an API exposed on custom ports:

http://server:8000/api
https://server:8443/api

When I test the API with https://editor.swagger.io, I can switch the protocol from HTTP to HTTPS on the page, but because the port is entered only once with the host together and used for both schemes, I cannot actually send the request to the correct HTTPS endpoint:

host: server:8000
basePath: /api
schemes:
  - http
  - https

Why not adding an additional property configuring the HTTP and HTTPS ports?

Activity

  1. webron commented on Nov 20, 2014

    @webron
    Member

    That's a good point.

  2. earth2marsh commented on Mar 10, 2015

    @earth2marsh
    Member

    👍

  3. mohsen1 commented on Mar 10, 2015

    @mohsen1
    Contributor

    My opinion:

    We should make it possible to provide a list of hosts. Swagger should not be deterministic which host should be used for which scheme.

  4. fehguy commented on Mar 10, 2015

    @fehguy
    Contributor

    Is it unreasonable to expect that https is always 443?

  5. webron commented on Mar 10, 2015

    @webron
    Member

    Yes. The OP.

  6. casualjim commented on Mar 10, 2015

    @casualjim
    Contributor

    I'm all for scheme: port type of mapping

    while swagger assumes it's http there is also wss in there and soon there is server push and so on with http2.
    Now there is no reason why somebody couldn't expose the swagger api over a rabbitmq messsage bus or some zeromq interface which supports these messaging paradigms.

    the host can be assumed to be the same but a scheme represents more often than not a port.

  7. olensmar commented on Mar 10, 2015

    @olensmar

    I agree - I think it would be insanely cool (almost) if one could open up for using swagger to describe APIs exposed over other protocols than HTTP(s) - (I'm primarily thinking CoAP, MQTT, WebSockets)

  8. webron commented on Mar 10, 2015

    @webron
    Member

    And pigeons.

  9. fehguy commented on Mar 10, 2015

    @fehguy
    Contributor

    @olensmar have you seen this project?

    https://github.com/swagger-api/swagger-socket

    Unbelievable potential with this.

  10. ndhar-1 commented on Jun 18, 2015

    @ndhar-1

    Just out of curiosity, when you say you want to expose the APIs on both http and https, you intend to accept both secured and unsecured connections? I think it defeats the purpose of having security ... ?

  11. prantlf commented on Jul 31, 2015

    @prantlf
    Author

    Well, discussing security is out of the scope of this issue, isn't it? :-)

    I can't know for what purpose is the API on the p[articular port used, how the connection is allowed the access to and how it is secured. All I deal with is that the server offers both schemes. I can either document and test both of them with Swagger, or I can use only one there.

    I agree that unless more details are given, using https is a "must" for the usual REST API security.

  12. webron commented on Mar 27, 2016

    @webron
    Member

    Parent: #560.

  13. fmvilas commented on May 16, 2017

    @fmvilas

    @olensmar you might be interested in the AsyncAPI specification: asyncapi.com.

  14. SergioArrighi commented on Jul 3, 2017

    @SergioArrighi

    +1
    I want to serve some calls on http and other on https. I'm testing my API locally with swagger UI and as host I configured localhost:8080. When I select HTTPS, calls are still sent to 8080. I don't understand how this is supposed to be working. Would swagger UI switch back to default 80 443 if I omit port in host configuration?
    Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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