Skip to content
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

Static url on subdomain #57

Open
Xerphis opened this issue Dec 10, 2018 · 0 comments
Open

Static url on subdomain #57

Xerphis opened this issue Dec 10, 2018 · 0 comments

Comments

@Xerphis
Copy link

Xerphis commented Dec 10, 2018

Hi.

I have problem with using debugbar, when i have set "url static" on other (sub) domain.

Earlier, I used a static url within the same domain (statics were in the "/cdn/" folder). In order for assets and open handler to be read correctly, I redirected everything containing _debugbar to "baseUrl + /_debugbar*" and it worked.

My prev uri settings look this:
baseUrl: / staticsUrl: /cdn/

After changing the url of the statics to the subdomain, debugbar generates addresses to the resources in the following way:
http://domain/http://cdn.domain/_debugbar/assets/stylesheets?m=1544445135&module (or http://domain/cdn.domain/ if i not set protocol in address)

My uri settings after changing to subdomain:
baseUrl: / staticsUrl: //cdn.domain/

Ok. In this moment, assets (js and css) loaded success, because everything after _debugbar is redirected to the base address (domain/ debugbar*_). It follows from this that for assets, the address is built in the following way:
src/JsRender.php

 $baseuri = rtrim($this->url->getBasePath(),'/').'/';
    $html .= sprintf(
        '<link rel="stylesheet" type="text/css" href="%s?m='.$m.'&%s">' . "\n",
        $baseuri.ltrim($this->url->getStatic(array('for'=>'debugbar.assets.css')),'/'),
        $time
    );

src/PhalconDebugbar.php
Unfortunately, the address "open handler" is created directly from statics::

$openHandlerUrl = $this->di['url']->getStatic( array('for'=>'debugbar.openhandler') );

and resulting in the creation of a non-existent address to an external domain resource statics:
http://cdn.domain/_debugbar/open?op=get&id=xxxxxxxxxxxxxxxxxxxxxxxx

Since the resources for debugbar are generated by the controller, would not it be better to read them directly from url->get instead of url->getStatic?
Is it not a mistake to read open handler from an address intended for static, or should the address to it be generated in the same way as in the case of assets?

Can I expect the next version, uri configuration options for debugbar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant