`static:warm` command doesn't work if laravel is behind a reverse proxy
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
- #13146 của @CapitaineToinon — đã đóng, không merge
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
Start with the statamic:static:warm command and trace how it builds the URLs it visits. Reproduce the failure from the Laravel service in the described Docker setup, then check whether the command uses the configured application URL or an unreachable local address. Done means the command can visit the URLs through the reachable web service; a linked pull request already exists, so check its status before starting.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug description
When using laravel being a reverse proxy, for example hosted using docker with laravel & statamic under a docker service and nginx under another service, the statamic:static:warn option fails because it tries to hit the laravel service directly, which isn't exposed.
$ php artisan statamic:static:warm
Please wait. This may take a while if you have a lot of content.
Compiling URLs...
[✔] Entries
[✔] Taxonomies
[✔] Taxonomy terms
[✔] Custom routes
[✔] Additional
Visiting 254 URLs...
/https://localhost cURL error 7: Failed to connect to localhost port 443 after 2 ms: Could not connect to server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://localhost
// ... same for all the URLs, not included
In this case, it's hitting localhost:443 when it should be hitting config('app.url') or in the case of docker, it could hit the docker container directly, for example http://nginx:80.
How to reproduce
Host statamic using docker having at least a php image and an nginx image:
services:
laravel:
build:
context: .
dockerfile: docker/laravel/Dockerfile
networks: [laravel]
environment:
...
web:
build:
context: .
dockerfile: docker/web/Dockerfile
ports: [80]
depends_on: [laravel]
networks: [laravel]
Then try to run from the laravel service:
docker compose exec laravel bash
$ php artisan statamic:static:warm
Because only the nginx is exposed, the command will fail.
Logs
Environment
Environment
Application Name: Statamic
Laravel Version: 12.38.1
PHP Version: 8.4.14
Composer Version: 2.9.0
Environment: local
Debug Mode: ENABLED
URL: web
Maintenance Mode: OFF
Timezone: UTC
Locale: en
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED
Drivers
Broadcasting: log
Cache: file
Database: pgsql
Logs: stack / single
Mail: log
Queue: database
Scout: meilisearch
Session: database
Storage
public/storage: LINKED
Pulse
Enabled: ENABLED
Version: v1.4.3
Livewire
Livewire: v3.6.4
Statamic
Addons: 1
Sites: 1
Stache Watcher: Enabled (auto)
Static Caching: half
Version: 6.0.0-alpha.16 PRO
Statamic Addons
statamic/eloquent-driver: dev-master
Statamic Eloquent Driver
Addon Settings: file
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: file
Entries: eloquent
Fieldsets: file
Form Submissions: eloquent
Forms: file
Global Sets: file
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: file
Revisions: eloquent
Sites: file
Taxonomies: file
Terms: eloquent
Tokens: eloquent
Installation
Fresh statamic/statamic site via CLI
Additional details
This has been discussed in the idea repo. I'm doing an issue as I intend to make a PR for this fix.
- Ngôn ngữ chính
- PHP
- Star
- 4.9k
- Fork
- 647
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 100
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của statamic/cms
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
assets
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Make native filesystem directory permissions configurable to support shared POSIX ACL accessĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
antlers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
No Code Attached Yet
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
joomla/joomla-cms#48611 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Automattic/safe-publish#716 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
FrameworkBundle SecurityBundle
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
symfony/symfony-docs#23277 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
[Sync EN] hard link does not need special permissionsCó thể đã có người làm @lacatoire đã nhận hôm nay. Đang mởsync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày