@@ -7,6 +7,11 @@ map $request_uri $error_page {
7
7
default /404/index.html;
8
8
}
9
9
10
+ map $uri $custom_content_type {
11
+ default "text/html";
12
+ ~(.*.ico)$ "image/x-icon";
13
+ }
14
+
10
15
server {
11
16
server_name _;
12
17
listen $VCAP_APP_PORT;
@@ -31,7 +36,6 @@ server {
31
36
proxy_set_header Host $cf_forwarded_host;
32
37
proxy_set_header X-Forwarded-For $remote_addr;
33
38
proxy_set_header X-Real-IP $remote_addr;
34
- error_page 403 404 =404 @fourohfour;
35
39
}
36
40
37
41
location / {
@@ -43,7 +47,6 @@ server {
43
47
proxy_set_header Host $cf_forwarded_host;
44
48
proxy_set_header X-Forwarded-For $remote_addr;
45
49
proxy_set_header X-Real-IP $remote_addr;
46
- error_page 403 404 =404 @fourohfour;
47
50
}
48
51
}
49
52
@@ -57,17 +60,19 @@ server {
57
60
58
61
rewrite ^ $error_page;
59
62
60
- proxy_hide_header Content-Type;
61
- add_header Content-Type 'text/html';
62
-
63
63
include nginx/snippets/proxy-to-static.conf;
64
+
65
+ proxy_hide_header Content-Type;
66
+ add_header Content-Type $custom_content_type;
67
+
68
+ break;
64
69
}
65
70
66
71
location = /favicon.ico {
67
72
log_not_found off;
68
73
access_log off;
69
74
}
70
-
75
+
71
76
location / {
72
77
rewrite ^([^.]*[^/])$ $1/;
73
78
rewrite (.*)/$ $1/index.html last;
@@ -222,6 +227,6 @@ server {
222
227
#include nginx/dynamic/deny-by-domain.conf;
223
228
# include nginx/snippets/ip-restrict-static.conf;
224
229
include nginx/snippets/proxy-to-storage.conf;
225
- error_page 403 = @fourohfour;
230
+ error_page 403 404 =404 @fourohfour;
226
231
}
227
232
}
0 commit comments