jfrog跨域问题处理
使用curl上传文件报错
[root@localhost ~]# curl -u admin:Tencent@123 -X PUT -T 1.0.1.tar.gz "http://192.168.153.102:18080/ui/local-aa"
Forbidden
1
2
2
查看服务日志
报错跨域问题
安装nginx解决跨域问题
nginx安装
yum install nginx -y
1
nginx启动
systemctl start nginx
1
添加jfrog配置
upstream artifactory {
server 127.0.0.1:28082;
}
upstream artifactory-direct {
server 127.0.0.1:28081;
}
server {
listen 18080 ;
server_name localhost;
if ($http_x_forwarded_proto = '') {
set $http_x_forwarded_proto $scheme;
}
## Application specific logs
access_log /var/log/nginx/artifactory.jfrog.com-access.log;
error_log /var/log/nginx/artifactory.jfrog.com-error.log;
rewrite ^/$ /ui/ redirect;
rewrite ^/ui$ /ui/ redirect;
chunked_transfer_encoding on;
client_max_body_size 0;
location / {
proxy_read_timeout 2400s;
proxy_pass_header Server;
proxy_cookie_path ~*^/.* /;
proxy_buffer_size 128k;
proxy_buffers 40 128k;
proxy_busy_buffers_size 128k;
proxy_pass http://artifactory;
proxy_set_header X-JFrog-Override-Base-Url $http_x_forwarded_proto://$host:$server_port;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $http_x_forwarded_proto;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
location ~ ^/artifactory/ {
proxy_pass http://artifactory-direct;
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
加载配置
nginx -s reload
执行上传文件
curl -u admin:Tencent@123 -X PUT -T 1.0.1.tar.gz "http://192.168.153.102:18080/artifactory/local-aa/"
1
执行下载文件操作
curl -u admin:Tencent@123 -O "http://192.168.153.102:18080/artifactory/local-aa/conf_proxy.zip"
1
上次更新: 2024/04/10, 17:39:32