Skip to content

[HttpKernel] Show full URI when route not found #39893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 5, 2021
Merged

Conversation

ruudk
Copy link
Contributor

@ruudk ruudk commented Jan 19, 2021

Q A
Branch? 5.x
Bug fix? no
New feature? yes
Deprecations? no
License MIT

When accessing a route that does not exist, Symfony throws a NotFoundHttpException that says No route found for "POST /path".

On some projects this might be good enough to find the root cause, but on projects that have lots of routes on different hosts, it becomes hard to understand how the request was initiated. Was it done over HTTP or HTTPS? What was the hostname? Did the user specify a port?

To make this easier, we now show the full URI of the path, like this: No route found for "POST https://www.symfony.com/path".

@carsonbot
Copy link

Hey!

This is.. this is amazing. Thank you!

To help keep things organized, we don't allow "Draft" pull requests. Could you please click the "ready for review" button or close this PR and open a new one when you are done?

Note that a pull request does not have to be "perfect" or "ready for merge" when you first open it. We just want it to be ready for a first review.

Cheers!

Carsonbot

@ruudk ruudk marked this pull request as ready for review January 19, 2021 14:41
@derrabus derrabus added this to the 5.x milestone Jan 19, 2021
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please add a test case?

@ruudk
Copy link
Contributor Author

ruudk commented Jan 19, 2021

@nicolas-grekas Added some tests.

When accessing a route that does not exist, Symfony throws a `NotFoundHttpException` that says `No route found for "POST /path"`.

On some projects this might be good enough to find the root cause, but on projects that have lots of routes on different hosts, it becomes hard to understand how the request was initiated. Was it done over HTTP or HTTPS? What was the hostname? Did the user specify a port?

To make this easier, we now show the full URI of the path, like this: `No route found for "POST https://www.symfony.com/path"`.
@fabpot
Copy link
Member

fabpot commented Feb 5, 2021

Thank you @ruudk.

@fabpot fabpot merged commit 2764f3c into symfony:5.x Feb 5, 2021
@ruudk ruudk deleted the patch-3 branch February 5, 2021 08:46
@fabpot fabpot mentioned this pull request Apr 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants