This commit is contained in:
2025-08-14 13:36:22 +00:00
parent fcb6caf1b9
commit 552e60440c

View File

@@ -37,11 +37,11 @@ func (h *DocsHandler) GetOpenAPISpec(w http.ResponseWriter, r *http.Request) {
} }
func (h *DocsHandler) ServeDocs(w http.ResponseWriter, r *http.Request) { func (h *DocsHandler) ServeDocs(w http.ResponseWriter, r *http.Request) {
_ = determineBaseURL(r) baseURL := determineBaseURL(r)
// Use relative SpecURL so the browser automatically uses the current origin and protocol // Use absolute SpecURL so the library does not try to read a local file path
htmlContent, err := scalar.ApiReferenceHTML(&scalar.Options{ htmlContent, err := scalar.ApiReferenceHTML(&scalar.Options{
SpecURL: "/openapi.json", SpecURL: fmt.Sprintf("%s/openapi.json", baseURL),
CustomOptions: scalar.CustomOptions{ CustomOptions: scalar.CustomOptions{
PageTitle: "Neo Movies API Documentation", PageTitle: "Neo Movies API Documentation",
}, },