Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe /

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Reverse Proxy Ajax issues


Reply


3 Posts   3496 Views

Avatar
Shawn Parr

Community Member, 60 Posts

28 January 2009 at 4:51am

I'm working on setting up some SilverStripe installs on a system that is behind a reverse proxy, using Apache2's proxy modules, and mod_proxy_html. For the most part SilverStripe works just fine, except for a few places in the admin pages.

Specifically there are the following issues:
1. Creating a new page gives an Ajax error. Clicking on one of the other admin sections and coming back shows that the page was actually created.
2. Deleting a page gives an Ajax error. As above going to another section and returning shows that the page was actually deleted.
3. Unable to add new users using the auth_external module. All our users will be from AD.

If I hit the backend server directly none of these issues exist. So it is happening during the proxy process. Since any Ajax errors that show a path are displaying the path of the backend server that leads me to suspect that a .js file is being generated or passed with a variable that has the hostname in an absolute path rather than relative. I'm digging around to find out if I can find where this might happen, but I thought I would drop a note here to see if anyone has ran across this before and found a solution, or if someone might have pointers where to start digging.

I should also mention that other functions are fine, like putting content on pages, changing their type, making forms, drag and drop editing of forms and the site tree view.

The specific errors are as follows:

1. Create a page:
Error in Ajax evaluator on line undefined: Parse error
var tree = $('sitetree'); var newNode = tree.createTreeNode("18", "New Page", "Page"); node = tree.getTreeNodeByIdx(0); if(!node){   node = tree.getTreeNodeByIdx(0); } node.open(); node.appendTreeNode(newNode); newNode.selectTreeNode();

2. Delete a page:
Error in Ajax evaluator on line undefined: Parse error
$('Form_EditForm').loadActionsFromString(''); $('Form_EditForm').loadActionsFromString(''); $('Form_EditForm').updateStatus('New page'); $('sitetree').setNodeTitle(18, 'New Page') $('Form_EditForm').elements.StageURLSegment.value = 'http://<backend server path>/new-page/' $('Form_EditForm').elements.LiveURLSegment.value = '' $('Form_EditForm').notify('PagePublished', $('Form_EditForm').elements.ID.value); statusMessage('Removed \'New Page\' from the draft site', 'good');

Thanks for any help.

Avatar
cpxksr

Community Member, 5 Posts

23 August 2009 at 1:15pm

I'm having the same issues, the biggest one for me is that the Security page doesn't work. ie. when I click the Security Group, I don't get the table with the users. Just a small "loading..." ajax in the bottom left corner, and then a gray div.

I'm running SS behind a dumb nginx proxy, doesn't do any caching or anything.

Everything else seems to be working just fine, the editor, uploads etc...

:)

Avatar
Shawn Parr

Community Member, 60 Posts

25 August 2009 at 1:07am

Unfortunately I never found a real solution to this problem. What I did was completely reconfigure how we were doing our reverse proxy.

Instead of having multiple sites in sub directories, we moved them all to their own dns addresses. So instead of example.com/site1 we changed to site1.example.com.

We then pass the hostname variable from the front end proxy to the upstream server. So both the proxy and the upstream have a virtual host for site1.example.com. This allows us not to have to use proxy_html at all, and made the setup much cleaner, except for duplicate apache conf files. I script that part of setup anyway, so it wasn't much skin off my back.

Once setup in this way the errors never occur, and it all works as intended. Of course this type of setup probably won't be useful to most people looking for an answer to this, but it did work for us. So we went with it. :)