2015-10-24 13:23:45 +02:00
|
|
|
server {
|
|
|
|
listen 80 default_server;
|
|
|
|
server_name labmashup;
|
|
|
|
|
|
|
|
# proxy for orion context broker
|
2015-10-24 14:05:14 +00:00
|
|
|
location /api/ {
|
2015-10-24 13:23:45 +02:00
|
|
|
proxy_redirect off;
|
|
|
|
proxy_set_header Host $http_host;
|
|
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
|
|
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
|
|
add_header Access-Control-Allow-Origin '$http_origin' always;
|
|
|
|
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE' always;
|
|
|
|
add_header Access-Control-Allow-Credentials 'true' always;
|
|
|
|
add_header Access-Control-Allow-Headers 'Origin,Content-Type,Accept' always;
|
|
|
|
add_header Content-Length 0;
|
|
|
|
add_header Content-Type text/plain;
|
|
|
|
|
|
|
|
return 204;
|
|
|
|
}
|
|
|
|
|
|
|
|
# rewrite url to exclude /api on context broker side
|
|
|
|
rewrite ^/api/?(.*) /$1 break;
|
|
|
|
|
|
|
|
add_header Access-Control-Allow-Origin '*' always;
|
|
|
|
add_header Access-Control-Allow-Credentials 'true' always;
|
|
|
|
|
2015-10-24 14:05:14 +00:00
|
|
|
proxy_pass http://orion:1026/;
|
|
|
|
}
|
|
|
|
|
2015-10-24 13:23:45 +02:00
|
|
|
error_page 404 /404.html;
|
|
|
|
location = /404.html {
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
}
|
|
|
|
|
|
|
|
error_page 500 502 503 504 /50x.html;
|
|
|
|
location = /50x.html {
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
}
|
|
|
|
}
|