knuckleswtf / knuckleswtf/scribe

Asset URLs are incorrect when Laravel is running in a subdirectory

Open
#733 2 comments 0 reactions 0 assignees View on GitHub
bug help wanted
Dominant language
PHP
Stars
2.3k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

### Scribe version

4.24.0

### PHP version

8.2

### Framework

Laravel

### Framework version

10.15.0

### Scribe config

```ruby
title => "API Documentation"
base_url => "http://localhost"
type => "laravel"
laravel.docs_url => "/api/docs"
try_it_out.enabled => false
try_it_out.base_url => "http://localhost"
auth.enabled => true
auth.default => true
auth.name => "token"
auth.placeholder => "{YOUR_TOKEN}"
```

### What happened?

When Laravel is running in a subdirectory, Scribe generates documentation with no CSS or JS working due to the fact that is expects `/vendor` is accessible.

I think one way to fix this would be to offer a way to use a CDN for assets rather than having them live in Laravel.

### Docs

- [X] I've checked [the docs](https://scribe.knuckles.wtf/laravel), the [troubleshooting guide](https://scribe.knuckles.wtf/laravel/troubleshooting), and [existing issues](https://github.com/knuckleswtf/scribe/issues?q=is%3Aissue+), but I didn't find a solution

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with Scribe 4.24.0 in a Laravel 10.15.0 application served from a subdirectory, then inspect the generated documentation's CSS and JavaScript URLs. Done means the documentation assets load correctly from that deployment path without requiring `/vendor` to be directly accessible.

Written by the indexing model from the issue text.

Assessment

Tech stack
laravel, php
Domain
backend, documentation
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.