Skip to content

Nginx redirecting to port 8080, when we have no trailing slash #10

Open
@pedrosimao

Description

@pedrosimao

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;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions