Fixing Incorrect Resource Path in Swagger with Laravel and Nginx
- 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".
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.