metacubexd icon indicating copy to clipboard operation
metacubexd copied to clipboard

添加https后端失败

Open muink opened this issue 1 year ago • 5 comments

我用nginx为metacubexd配置了反向代理, 使其页面支持https 但是添加后端时却返回404 同样的配置, 使用yacd-meta却可以正常使用, 请问有什么解决办法吗

sing-box:

{
	"experimental": {
		"clash_api": {
			"external_controller": "[::1]:9090",
			"external_ui": "/var/run/homeproxy/ui",
			"secret": "aacceebd-5555-6666-6666-261689827a1b",
			"store_mode": true,
			"store_selected": true,
			"cache_file": "/etc/homeproxy/clash_cache.db"
		}
	}
}

nginx:

location /homeproxy/ {
	proxy_set_header Host $host;
	proxy_set_header X-Real-IP $remote_addr;
	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
	proxy_set_header X-Forwarded-Proto $scheme;
	proxy_pass http://localhost:9090/;
	proxy_redirect default;
	proxy_set_header Upgrade $http_upgrade;
	proxy_set_header Connection upgrade;
	proxy_set_header Connection "keep-alive";
}

1

muink avatar Dec 02 '23 08:12 muink

api需要单独代理,得有2条,我的后端地址是55555端口,这样配置就可以。

location ^~ /api/ {
    proxy_pass http://127.0.0.1:55555/; 
    proxy_set_header Host $host; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header REMOTE-HOST $remote_addr; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    proxy_set_header X-Forwarded-Proto $scheme; 
    proxy_http_version 1.1; 
    add_header Cache-Control no-cache; 
}

location ^~ / {
    proxy_pass http://127.0.0.1:55555/ui/; 
    proxy_set_header Host $host; 
    proxy_set_header X-Real-IP $remote_addr; 
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
    proxy_set_header REMOTE-HOST $remote_addr; 
    proxy_set_header Upgrade $http_upgrade; 
    proxy_set_header Connection "upgrade"; 
    proxy_set_header X-Forwarded-Proto $scheme; 
    proxy_http_version 1.1; 
    add_header Cache-Control no-cache; 
}

然后后端填 https://your-domain/api 就行

ericjuice avatar Dec 24 '23 13:12 ericjuice

一样的配置还是404

muink avatar Dec 25 '23 08:12 muink

一样的配置还是404

不使用路径的反向代理,用子域名(比如mydomain.com)做反代。我之前用Yacd就是路径的不行。然后直接访问域名 https://mydomain.com ,地址就填 https://mydomain.com/api. image

ericjuice avatar Dec 25 '23 09:12 ericjuice

我觉得还是这个dashboard有点问题 直接用curl都可以访问了

muink avatar Dec 25 '23 09:12 muink

[Error] Fetch API cannot load http://xxxxxxxxxxxxx:9090/ due to access control checks. This is the reason, needs to add cors control access.

jjhesk avatar May 14 '24 04:05 jjhesk