L5-Swagger icon indicating copy to clipboard operation
L5-Swagger copied to clipboard

Fixing Incorrect Resource Path in Swagger with Laravel and Nginx

Open gustavoDuarte96 opened this issue 1 year ago • 1 comments

  • L5-Swagger Version: 8.5.1
  • PHP Version: 8.2.12
  • OS: Debian

Description:

I am facing a problem with Swagger resource management in my Laravel application, and this inconvenience is compounded by the use of Nginx as a proxy server. Instead of accessing Swagger resources through private domains, I need it to use public domains, where the private IP address with the port is translated to a public domain with a specific path, such as "domain/api_name".

The problem lies in the fact that Swagger, instead of getting the CSS and JS resources from "domain/api_name/", is fetching them directly from "domain/".

How can I solve this problem? It is important to note that there will be multiple APIs hosted on this domain, each with a different path to "/api_name".

gustavoDuarte96 avatar Mar 18 '24 18:03 gustavoDuarte96

We need to turn off the option:

'use_absolute_path' => false,

In my case it solved the problem when the domain has an SSL certificate and the swagger files were downloaded via HTTP.

andrey-helldar avatar Mar 26 '24 11:03 andrey-helldar