You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Laravel集成24Slides/laravel-saml2时SAML ACS地址不匹配报错

关于Laravel中24Slides/laravel-saml2与SimpleSAML集成的ACS URL不匹配问题

我是SimpleSAMLphp新手,项目时间紧张,正在快速学习相关内容。我在Laravel项目中使用24Slides/laravel-saml2(未采用官方README推荐的aacotroneo/laravel-saml2),此前小问题已解决,但访问https://localhost:8443/login提交账号密码后,跳转至500服务器错误页面,报错信息为:

The response was received at https://localhost/saml2/acs instead of https://localhost:8443/saml2/acs

相关配置文件信息

config/saml2.php

<?php

return [
    'default' => 'default',
    'tenantModel' => \Slides\Saml2\Models\Tenant::class,
    'useRoutes' => true,
    'routesPrefix' => 'saml2',
    'routesMiddleware' => ['web'],
    'retrieveParametersFromServer' => false,
    'loginRoute' => 'login',
    'logoutRoute' => 'logout',
    'errorRoute' => env('SAML2_ERROR_URL'),
    'strict' => true,
    'debug' => env('SAML2_DEBUG', env('APP_DEBUG', false)),
    'proxyVars' => true,
    'sp' => [
        'NameIDFormat' => 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
        'entityId' => 'https://localhost:8443/saml2/metadata',
        'assertionConsumerService' => [
            'url' => 'https://localhost:8443/saml2/acs',
        ],
        'singleLogoutService' => [
            'url' => 'https://localhost:8443/saml2/sls'
        ],

        'x509cert' => file_get_contents(base_path('storage/saml/sp-cert.crt')),
        'privateKey' => file_get_contents(base_path('storage/saml/sp-key.pem')),
    ],

    'load_migrations' => true,

    'idp' => [
        'entityId' => 'https://localhost:8443/simplesaml/saml2/idp/metadata.php',
        'singleSignOnService' => [
            'url' => 'https://localhost:8443/simplesaml/saml2/idp/SSOService.php',
        ],
        'singleLogoutService' => [
            'url' => 'https://localhost:8443/simplesaml/saml2/idp/SingleLogoutService.php',
        ],
        'x509cert' => env('SAML2_IDP_X509', ''),
    ],
];

simplesaml/metadata/saml20-sp-remote.php

$metadata['https://localhost:8443/saml2/metadata'] = [
    'AssertionConsumerService' => [
        [
            'Location' => 'https://localhost:8443/saml2/acs',
            'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST',
        ],
    ],
    'SingleLogoutService' => [
        [
            'Location' => 'https://localhost:8443/module.php/saml2/logout',
            'Binding' => 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect',
        ],
    ],
];

.env 关键配置片段

APP_NAME=Laravel
APP_ENV=local
APP_FORCE_HTTPS=true
APP_KEY=
APP_DEBUG=true
APP_TIMEZONE=
APP_URL=https://localhost:8443

SAML2_DEBUG=true
SAML2_SP_ENTITYID=https://localhost:8443/saml2/metadata
SAML2_SP_ACS=https://localhost:8443/saml2/acs
SAML2_IDP_ENTITYID=https://localhost:8443/metadata
SAML2_IDP_SSO=https://localhost:8443/sso
SAML2_IDP_SLO=https://localhost:8443/slo
SAML2_IDP_X509=

补充说明

  • 已排查过类似问题,找到同类型Laravel SAML集成项目的相关案例
  • 当前运行环境:Docker、NGINX、Laravel、SimpleSAML

请问还需要提供哪些文件或信息以进一步排查问题?

内容的提问来源于stack exchange,提问作者ameria_saarne

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.12 20:42:45