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

"rewrite-links" removes base tag from content #9

Open
jcbrand opened this issue Sep 27, 2012 · 2 comments
Open

"rewrite-links" removes base tag from content #9

jcbrand opened this issue Sep 27, 2012 · 2 comments

Comments

@jcbrand
Copy link

jcbrand commented Sep 27, 2012

When using Deliverance 0.6 (with Plone):

If we have a proxy rule like this:

  <proxy path="wildcard:*">
    <dest href="http://localhost:8080" />
    <response rewrite-links="1" />
  </proxy>

And then we replace the theme head with the content head:

<replace content="/html/head" theme="/html/head" />

With "rewrite-links" enabled, the <base> tag is stripped from the content head and not inserted into the theme, with "rewire-links" off, the <base> tag does appear.

@jcbrand
Copy link
Author

jcbrand commented Sep 27, 2012

Just tested it now with Deliverance 0.6.1, but the problem persists.

@ejucovy
Copy link
Member

ejucovy commented Sep 27, 2012

Looks like this is happening in lxml.html.make_links_absolute -- unless explicitly disabled, that function's default behavior is to use the <base> tag to make the links absolute, and then discard the <base> tag from the resulting document. We could just copy over the logic in lxml.html.resolve_base_href but without the b.drop_tree().

I understand the logic of the current behavior though -- if all the links relative to the base href are made absolute and then rewritten, the base tag presumably doesn't serve any purpose anymore. Could you spell out a case where you'd still want the base tag present after rewriting links?

And, in that case, should the base href itself be rewritten too? (Or, alternatively, should we only rewrite the base href, and leave all other links relative to it?)

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

2 participants