No route found for "POST /login" (from "http://xx.net/authentication/signin")

Discussão em 'Angular' iniciado por Jan Mareš, Dezembro 24, 2024.

  1. Jan Mareš

    Jan Mareš Guest

    I'm having trouble deploying my web application on a server. I have created an API in Symfony using various components and a client in Angular with npm. It works perfectly fine on my local machine, but when I try to run it on the server using Apache, I run into an issue. When I try to log in, I get this error:

    No route found for "POST /login" (from "http://xx.net/authentication/signin")

    This is called from the client. When I access xx.net/api, the Symfony page displays without errors, so that seems to be working fine. However, there’s likely an issue with the proxy, which I can't figure out how to resolve. Can someone please help?

    Here’s my Apache configuration:

    server@xx:~$ cat /etc/apache2/sites-enabled/xx.net.conf <VirtualHost *:80>

    ServerAdmin xx@gmail.com
    ServerName xxnet
    DocumentRoot /var/www/xx.net

    # Přesměrování požadavků na /api do /var/www/xx.net-api
    Alias /api /var/www/xx.net-api/public

    # Nastavení oprávnění pro přístup k souborům API
    <Directory /var/www/xx.net-api>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    #SetHandler "proxy:fcgi://127.0.0.1:9000"
    SetHandler "proxy:unix:/run/php/php7.4-fpm.sock|fcgi://localhost"
    #SetHandler "proxy:fcgi:///run/php/php7.4-fpm.sock"
    Require all granted
    </Directory>

    <Directory />
    Options FollowSymLinks
    AllowOverride All
    </Directory>

    <Directory /var/www/xx.net>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Require all granted
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/xx-error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access_xx.log combined


    server@xx:/var/www/xx.net-api$ sudo -su www-data php bin/console debug:router api_user_login
    +--------------+-------------------------------------------------------------+
    | Property | Value |
    +--------------+-------------------------------------------------------------+
    | Route Name | api_user_login |
    | Path | /api/login |
    | Path Regex | #^/api/login$#sD |
    | Host | ANY |
    | Host Regex | |
    | Scheme | ANY |
    | Method | POST |
    | Requirements | NO CUSTOM |
    | Class | Symfony\Component\Routing\Route |
    | Defaults | _controller: App\Controller\Api\UserController::loginAction |
    | Options | compiler_class: Symfony\Component\Routing\RouteCompiler |
    +--------------+-------------------------------------------------------------+

    Continue reading...

Compartilhe esta Página