next-nginx-routes
next-nginx-routes copied to clipboard
Nginx redirecting to port 8080, when we have no trailing slash
I am facing a strange issue with Nginx config. When I try to put url directly on the browser without a trailing slash, my url gets redirected to 8080 port, and does not take into account the relative paths. Here is my Nginx config:
server {
listen 8080;
server_name localhost;
root /app;
include /app/next-routes.conf;
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /app;
}
}
And here is an example of my next-routes.conf:
location ~ ^/dashboards/controlcenter(?:/)?$ {
try_files /index.html /index.html;
}
location ~ ^/dashboards/controlcenter/404(?:/)?$ {
try_files /404.html /index.html;
}
location ~ ^/dashboards/controlcenter/audience_builder/audiences(?:/)?$ {
try_files /audience_builder/audiences.html /index.html;
}
location ~ ^/dashboards/controlcenter/audience_builder/manage_categories(?:/)?$ {
try_files /audience_builder/manage_categories.html /index.html;
}
location ~ ^/dashboards/controlcenter/audience_builder/query_templates(?:/)?$ {
try_files /audience_builder/query_templates.html /index.html;
}
location ~ ^/dashboards/controlcenter/audience_builder/title_lists(?:/)?$ {
try_files /audience_builder/title_lists.html /index.html;
}