Open mo4islona opened 3 years ago
We should load swagger from relative url because nest application could be proxied with some path prefix by some server like NGINX behind.
For example, we have Nest app with simple /docs/ route. And some SPA application on same domain. We will configure NGINX like
location /api { // upstream to Nest app } location { // route everything didnt match /api prefix to static files }
In these cause a broken link swagger.json because it will be generated from the root
And these why all static files are loaded in original SwaggerModule
SwaggerModule
<script src="./swagger-ui-bundle.js"> </script> <script src="./swagger-ui-standalone-preset.js"> </script> <script src="./swagger-ui-init.js"> </script>
We should load swagger from relative url because nest application could be proxied with some path prefix by some server like NGINX behind.
For example, we have Nest app with simple /docs/ route. And some SPA application on same domain. We will configure NGINX like
In these cause a broken link swagger.json because it will be generated from the root
And these why all static files are loaded in original
SwaggerModule