Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[BrowserKit] PR #26244 broke easy testing of domains specific routes #32791

Copy link
Copy link
Closed
@c33s

Description

@c33s
Issue body actions

Description

the PR #26244 broke flexible testing of domain specific routes for me. is there a way to do this after the PR or can we say we have a bug here?

it should be possible to access localhost but set HTTP_HOST to simulate a different domain.

if you have a route which should only be accessible via a specific domain

admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin
    host: admin.example.com

it was easy to test this before, as all functional tests of symfony run against localhost without the need to set up a real webserver with all required vhost names. i simple have done this:

$client->request('GET', '/admin', [], [], ['HTTP_HOST' => 'example.com']);
// will return 404
$client->request('GET', '/admin', [], [], ['HTTP_HOST' => 'admin.example.com']);
// will return 200

now i cannot test that specific routes should be only accessible via a specific domain.

additional all functional tests to routes which require a domain need the route to be configured as

mybundle:
    resource: "@MyBundle/Resources/config/routing.yml"
    host:     "{hostname}"
    defaults: { hostname: example.com }
    requirements:
        hostname:     example.com|localhost

if not adding localhost to all routes with domain requirements i will get a 404 for all that routes.

this change add unnecessary overhead and boilerplate to the whole testing and routing.

Possible Solution
please rething this change. at least give us a flag or a own method to get the old behavior back.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.