-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
In subdomain-per-language scenarios, babel_view does not work because of CORS #310
Comments
I would say that you should not edit the site like this. In the end you are relying on Zope Acquisition to edit the site: you can always get /en inside /es. I would say this is a "hack". In this case of scenarios (edit the content of one site served through several domains), we configure a special admin domain (admin.rudd-o.com) pointing to the root of the Plone site to edit the contents. |
This is where it craps out:
XHR requests to authenticated data need to specify Ideally, the code that wires Just because there are bugs in the code does not mean the right solution is to work around them by actual hacks, like setting up an admin domain just because CORS is broken by the code. There is no reason why I should be forced to use an admin domain when what's buggy is the manner in which the XHR request is being done. plone.app.multilingual advertises support for multi-subdomains per-language domains — it is logical that a bug which prevents this feature from working should be fixed. FYI, the site does have an admin domain, but that requires a special HTTP |
I don't think this has ever been a feature of plone.app.multilingual. In fact there is one setting in the multilingual settings of Plone (in Plone 4.3 PloneLanguageTool and Plone 5 in ILanguageUtility) regarding the use of subdomains. And what this setting does is to decide the language for the user according to the subdomain setting. I don't know if it works, because I haven't ever used it. That's why I say that I don't think that your use case is in any case supported. |
I've been using that multi-domain feature for close to a decade (since LinguaPlone, yes) and it works, but -- as you can see from this bug report -- the editor does not work very well in p.a.m because of implementation decisions unique to p.a.m. Furthermore, multi-domain is practically the only way one can get a search engine to index multilingual sites. I'm surprised you don't even know this feature works and has existed for a decade. I'm guessing more testing would have allowed the devs to figure out this broke before p.a.m. superseded LinguaPlone. |
Search engines index properly our multilingual sites and they are no served
in different domains, we always work with the /en /es folders, even with
LinguaPlone.
…--
Mikel Larreategi
CodeSyntax
+34 943821780
Rudd-O <[email protected]> igorleak hau idatzi zuen (2018 mar. 28,
Asz 14:09):
I've been using that multi-domain feature for close to a decade (since
LinguaPlone, yes) and it works, but -- as you can see from this bug report
-- the editor does not work very well in p.a.m because of implementation
decisions unique to p.a.m. Furthermore, multi-domain is practically the
only way one can get a search engine to index multilingual sites.
I'm surprised you don't even know this feature works and has existed for a
decade.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#310 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAx41XyHjELX4ONvl3RwwFtV7R9ukIMLks5ti32NgaJpZM4S9DbF>
.
|
My site runs with a VHM translation like this:
So that
rudd-o.com
runs the/en
folder, andes.rudd-o.com
runs the/es
folder.When I go to the Babel edit page of any translated content, the URL
.../content-item-id/babel_view
is loaded via XHR to display the original content on the left side of the Babel editor.But here's the catch: since the item I am editing is in
/en
and loads viarudd-o.com
, but the original item is in/es
and loads viaes.rudd-o.com
(automatic redirect to prevent duplicate content in search engines), the browser does a CORS preflight request (anOPTIONS
request) prior to loading it.I've already set the correct CORS headers for the
OPTIONS
request:but then the subsequent GET request, which should include the
Cookie:
or theAuthorization:
header (both valid for the entire domain, not just the host name), does not include the credentials.What this has as net effect is that the
babel_view
becomes a302 Found
redirect to the Plone login page. And, of course, the original text does not load.Now, I've verified correctly that the
babel_view
XHR loads correctly, when the credentials are specified with cURL as headers. So it's not a problem with the URL rewriting. I've also verified that the browser does not send theCookie:
orAuthorization:
header, which is what is causing the302 Found
redirect.I believe the correct solution is to use the
withCredentials: true
parameter to whatever JavaScript XHR code is loading thebabel_view
page in thebabel_edit
view. That way, the browser will honor theAccess-Control-Allow-Credentials: true
CORS directive, and the Plone site will serve the original language content to the Babel editor.Thanks for fixing this!
The text was updated successfully, but these errors were encountered: