Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[WebProfilerBundle] make webprofiler links absolute path #51722

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

Conversation

shyim
Copy link
Contributor

@shyim shyim commented Sep 22, 2023

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets
License MIT
Doc PR

We use a nodejs proxy to hot-reload js/css changes. The proxy url is different to the symfony url, so we replace some urls. It would make our life easier when all generated links are absolute paths (without the host).

@carsonbot carsonbot added this to the 5.4 milestone Sep 22, 2023
@shyim shyim changed the title fix: make webprofiler links absolute path [WebProfilerBundle] fix: make webprofiler links absolute path Sep 22, 2023
@shyim shyim changed the title [WebProfilerBundle] fix: make webprofiler links absolute path [WebProfilerBundle]make webprofiler links absolute path Sep 22, 2023
@shyim shyim changed the title [WebProfilerBundle]make webprofiler links absolute path [WebProfilerBundle] make webprofiler links absolute path Sep 22, 2023
@@ -537,7 +537,7 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {

this.load(
'sfwdt' + token,
'{{ url("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
'{{ path("_wdt", { "token": "xxxxxx" })|escape('js') }}'.replace(/xxxxxx/, newToken),
Copy link
Member

Choose a reason for hiding this comment

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

isn't url() for absolute URLs and path() for relative ones? the PR title says the opposite

@ro0NL
Copy link
Contributor

ro0NL commented Sep 27, 2023

ref #37576

@stof
Copy link
Member

stof commented Sep 27, 2023

This breaks cases where your configure ajax requests to replace the toolbar for ajax responses and those responses from your API come from a different domain than the main document, which is exactly the use case for which we switched to absolute URLs.

For your use case of proxying, the right solution IMO is to configure your proxy as a trusted proxy to make Symfony aware of the public-facing domain name to use.

@stof
Copy link
Member

stof commented Sep 27, 2023

This PR gets a -1 vote from me.

@shyim shyim closed this Sep 27, 2023
@shyim
Copy link
Contributor Author

shyim commented Sep 27, 2023

Ahh yea forgot the <base>.

trusted_proxies are annoying for development, especially when you are a framework and not just a single website.

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.

5 participants