nginx: error pages are now respond as json if accept header request it.
As a consequence, we can rely on them to display a correct information on user pages through angularJS.
This commit is contained in:
parent
cf290732dc
commit
63a55a8a0b
12 changed files with 103 additions and 27 deletions
|
|
@ -35,4 +35,29 @@ server {
|
|||
location /tags/ {
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
|
||||
location = /welcome.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e404.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e413.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e500.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,31 @@ server {
|
|||
#auth_basic_user_file ficpasswd;
|
||||
}
|
||||
|
||||
location = /welcome.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e404.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e413.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e500.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
|
||||
location /edit {
|
||||
rewrite ^/.*$ /index.html;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,15 +41,27 @@ server {
|
|||
}
|
||||
location = /welcome.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e404.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e413.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
location = /e500.html {
|
||||
internal;
|
||||
if ($http_accept ~ "^application/json") {
|
||||
rewrite ^/(.*).html$ /$1.json;
|
||||
}
|
||||
}
|
||||
|
||||
location ~ ^/[A-Z] {
|
||||
|
|
|
|||
Reference in a new issue