-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathnginx.conf
More file actions
66 lines (55 loc) · 1.72 KB
/
Copy pathnginx.conf
File metadata and controls
66 lines (55 loc) · 1.72 KB
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
http {
server {
listen 8080;
server_name $app_url;
# Définir les variables d'environnement
set $impala_uri "http://$host";
# Règle 2 : Rediriger la racine vers /index.html
location = / {
return 301 /index.html;
}
# Règle 3 : Ne pas réécrire les fichiers avec certaines extensions
location ~* \.(html|zip|txt|json|map|png|css|ico|rdf|htm|ttl)$ {
try_files $uri $uri/ =404;
}
# Règle 5 : Rediriger les requêtes GET vers /sparql sans text/html dans Accept
location = /sparql {
if ($http_accept !~ "text/html") {
set $args $args&query;
proxy_pass $rdf4j_api_uri;
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;
}
}
# Règle 6 : Ne pas réécrire les requêtes GET vers /sparql
location = /sparql {
if ($request_method = GET) {
return 200;
}
}
# Règle 7 : Rediriger les requêtes POST vers /sparql sans text/html dans Accept
location = /sparql {
if ($request_method = POST) {
if ($http_accept !~ "text/html") {
proxy_pass $rdf4j_api_uri;
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;
}
}
}
# Règle 9 : Rediriger les requêtes avec text/html dans Accept
location / {
if ($http_accept ~ "text/html") {
return 302 /sparql?query=DESCRIBE<$impala_uri$request_uri>;
}
}
# Règle 10 : Ajouter l'en-tête Access-Control-Allow-Origin
add_header Access-Control-Allow-Origin "*";
# Règle 11 : Ajouter l'en-tête Server
add_header Server "nginx";
}
}