Skip to content

AJAX requests not excluded as expected #12122

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

Closed
mykiwi opened this issue Oct 4, 2014 · 7 comments
Closed

AJAX requests not excluded as expected #12122

mykiwi opened this issue Oct 4, 2014 · 7 comments

Comments

@mykiwi
Copy link
Contributor

mykiwi commented Oct 4, 2014

I just tried the new feature AJAX requests in the web debug toolbar by replacing "symfony/symfony": "~2.5" with "symfony/symfony": "2.6.*@dev" (don't know if there is a better solution for doing it) and I saw something weird :

capture d ecran 2014-10-04 02 17 45

I would have your opinion before doing a PR for solving this problem.

The default configuration for the option excluded_ajax_paths is ^/bundles|^/_wdt.
But the web debug toolbar is visible only in dev and the urls are app_dev.php/....
So, I thought of 2 solutions:

  1. update the standard edition app/config/config_dev.yml file by adding in the web_profiler : excluded_ajax_paths: "^/app_dev.php/bundles|^/app_dev.php/_wdt"
  2. add the environment in the default value of excluded_ajax_paths

What do you think ?
Is there a better solution ? Or the problem is just because I didn't use it the right way.

@stof
Copy link
Member

stof commented Oct 4, 2014

^/app_dev.php/bundles would be wrong. Installed assets won't use the file name in the path.

The default regex should be updated to take this case into account, while not removing the support of setup using url rewriting or the builtin webserver (and so not using this base path). This is a case which was forgotten when implementing it

@fabpot
Copy link
Member

fabpot commented Oct 4, 2014

@stof The /bundles part of the regex is not for Symfony assets (as they are not included via Ajax anyway); this is more for AngularJS apps as it loads templates via Ajax and they are often in this directory.

@stof
Copy link
Member

stof commented Oct 4, 2014

and angular templates are assets as far as Symfony is concerned

@layanto
Copy link

layanto commented Nov 8, 2014

Why is ^/bundles included in the default excluded_ajax_paths? Default configuration should not make assumptions about if the project is using AngularJS and if the templates are in bundles directory. I think the excluded_ajax_paths should simply be ^/_wdt|^/app_dev.php/_wdt to exclude web debug toolbar.
If one wants to exclude /bundles then can be done in config.yml for their specific projects?

@Tobion
Copy link
Contributor

Tobion commented Nov 8, 2014

I agree with @layanto. Otherwise people will wonder why their routes starting with /bundles won't be displayed as ajax requests.

@mykiwi
Copy link
Contributor Author

mykiwi commented Apr 5, 2015

I'm agree with @layanto and @Tobion

@fabpot
Copy link
Member

fabpot commented Apr 6, 2015

👍 for removing /bundles from the regex.

fabpot added a commit that referenced this issue May 16, 2015
This PR was squashed before being merged into the 2.6 branch (closes #14217).

Discussion
----------

[WebProfilerBundle] Fix regexp

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12122
| License       | MIT
| Doc PR        |

Old PR #12124

Commits
-------

091b37e [WebProfilerBundle] Fix regexp
@fabpot fabpot closed this as completed May 16, 2015
ostrolucky pushed a commit to ostrolucky/symfony that referenced this issue Mar 25, 2018
This PR was squashed before being merged into the 2.6 branch (closes symfony#14217).

Discussion
----------

[WebProfilerBundle] Fix regexp

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#12122
| License       | MIT
| Doc PR        |

Old PR symfony#12124

Commits
-------

091b37e [WebProfilerBundle] Fix regexp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants