Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Request to static files return 404 after anti-leech enabled #7752

Open
wan92hen opened this issue Jan 22, 2025 · 1 comment
Open

[Bug] Request to static files return 404 after anti-leech enabled #7752

wan92hen opened this issue Jan 22, 2025 · 1 comment
Assignees
Milestone

Comments

@wan92hen
Copy link
Contributor

Contact Information

No response

1Panel Version

v1.10.23

Problem Description

Request to static files return 404 after anti-leech enabled, for websites created from application deployment.

The final configuration will be like this after anti-leech enabled. And requests matched location ~ .*\.(js|css|png|jpg|jpeg|gif|ico|bmp|swf|eot|svg|ttf|woff|woff2)$ will not be passed to the backend application.

server {
    listen 80 ; 
    server_name 172.16.10.154; 
    index index.php index.html index.htm default.php default.htm default.html; 
    proxy_set_header Host $host; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header X-Forwarded-Host $server_name; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_http_version 1.1; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection $http_connection; 
    access_log /www/sites/172.16.10.154/log/access.log main; 
    error_log /www/sites/172.16.10.154/log/error.log; 
    location ^~ /.well-known/acme-challenge {
        allow all; 
        root /usr/share/nginx/html; 
    }
    location / {
        proxy_pass http://127.0.0.1:8090; 
    }
    location ~ .*\.(js|css|png|jpg|jpeg|gif|ico|bmp|swf|eot|svg|ttf|woff|woff2)$ {
        expires 30d; 
        log_not_found off; 
        valid_referers none 172.16.10.154; 
        if ($invalid_referer) {
            return 404; 
            access_log off; 
        }
    }
}

Steps to Reproduce

  1. Install Halo from app store.
  2. Create a website for the installed Halo.
  3. Enable anti-leech in the website configuration.

The expected correct result

No response

Related log output

Additional Information

No response

@wanghe-fit2cloud
Copy link
Member

Thanks for your feedback. We will optimize this issue in future versions.

@wanghe-fit2cloud wanghe-fit2cloud added this to the v1.10.24-lts milestone Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants