I am trying to test my API documentation using openapi: 3.0.1
format. When trying to execute the endpoints from SwaggerHub documentation, I get the 403 error with the following headers:
content-length: 0
date: Thu, 11 Oct 2018 04:28:28 GMT
server: nginx/1.8.0 + Phusion Passenger 5.0.22
status: 403 Forbidden
x-powered-by: Express, Phusion Passenger 5.0.22
The issue is both for Safari as well as Chrome browsers.
I have also enabled CORS
for my golang application as per the following snippet:
allowedOrigins := handlers.AllowedOrigins([]string{"*"})
allowedHeaders := handlers.AllowedHeaders([]string{"X-Requested-With", "Content-Type", "Authorization", "Accept"})
allowedMethods := handlers.AllowedMethods([]string{"GET", "POST", "PUT", "HEAD", "OPTIONS"})
log.Fatal(http.ListenAndServe(":3030", handlers.CORS(allowedOrigins, allowedHeaders, allowedMethods)(router)))
Also, enabled browser security for CORS as per this article.