Angular NGINX fail on parameter request

Discussão em 'Angular' iniciado por Salvosnake, Novembro 27, 2024.

  1. Salvosnake

    Salvosnake Guest

    i front on strange error, i have this route

    {path: 'applogin/:appname', component: BusinessManagementComponent}


    i want call BusinessManagementComponent with parameter appname, on component logic i use this.ApplicationName = this.route.snapshot.paramMap.get('appname'); for get param value. This snippet on dev mode work fine, i mean if i use ng serve for launch build. If i use production env, with NGINX deploy i have 500 error with this log:

    12 rewrite or internal redirection cycle while internally redirecting to "/index.html", client: 127.0.0.1, server: localhost, request: "GET /applogin/ HTTP/1.1", host: "localhost"


    this is my nginx conf

    server {
    listen 80;
    server_name localhost;

    # Percorso alla cartella build di Angular
    root /path/to/your/angular-app/dist/browser;
    index index.html;

    # Gestione delle rotte Angular
    location / {
    try_files $uri $uri/ /index.html;
    }

    # Gestione degli asset statici
    location ~* \.(?:ico|css|js|map|json|png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot|txt|xml)$ {
    expires 6M;
    access_log off;
    add_header Cache-Control "public";
    }

    # Opzionale: Compressione Gzip
    gzip on;
    gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
    }


    someone have some idea, how fix it?

    Continue reading...

Compartilhe esta Página