Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
gayanW committed Oct 9, 2017
1 parent 596217f commit 8bc1b8d
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
package org.openmrs.module.webservices.rest.web.controller;

import com.google.common.net.HttpHeaders;
import io.swagger.models.Scheme;
import org.openmrs.module.webservices.docs.swagger.SwaggerSpecificationCreator;
import org.springframework.stereotype.Controller;
Expand All @@ -31,10 +32,15 @@ String getSwaggerSpecification(HttpServletRequest request) throws Exception {
host += ":" + request.getServerPort();
}

String scheme = request.getHeader(HttpHeaders.X_FORWARDED_PROTO);
if (scheme == null) {
scheme = request.getScheme();
}

return new SwaggerSpecificationCreator()
.host(host)
.basePath(request.getContextPath() + "/ws/rest/v1")
.scheme(Scheme.forValue(request.getScheme()))
.scheme(Scheme.forValue(scheme))

.BuildJSON();
}
Expand Down

0 comments on commit 8bc1b8d

Please sign in to comment.