Preview button does not work (Page not found)

408 views
Skip to first unread message

Sang Won Lee

unread,
Jan 3, 2016, 9:37:33 PM1/3/16
to General Open edX discussion
When I press 'preview' button from Studio, link does not work.

Assuming myedx.com is my domain, the link generated after clicking preview button is in a following form:

However, this page does not exist (Page Not Found error)

I have set all related properties from cms/lms json files, and 'View Live' button works just fine.
PREVIEW_LMS_BASE
LMS_BASE
CMS_BASE

I have searched all 'Preview' related topics from this forum, but none of them helped yet.
Does anyone experience the similar issue? or have any solution to this?

p.s. I am using 2015/11/17 master branch

Anna Winklerová

unread,
May 16, 2016, 9:10:42 AM5/16/16
to General Open edX discussion
Hi.

I'm sitting on the same thing right now. The Preview button doesn't work for unpublished content. Once it gets published, although not visible for students, it gets redirected 

from

http://LMS_BASE/courses/course-v1:MU+e01+2016_01/jump_to/block-v1:MU+e01+2016_01+type@vertical+block@....ID....

to 


and it works but it is the same as the View live button once the content gets published. I would like to get it work... will keep searching. Have you found solution yet? 


-- Anna

Liubov Fomicheva

unread,
May 17, 2016, 6:42:36 AM5/17/16
to General Open edX discussion
Hello colleagues,

  The preview feature is implemented with domain name mappings. You need to create separate domain name for preview version of the platform (e.g. preview.myedx.com) and set key for environment variable HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS (in lms.env.json and cms.env.json or corresponding server-vars.yml variable EDXAPP_MODULESTORE_MAPPINGS) to the value that would catch your new domain name.
  The variable PREVIEW_LMS_BASE should be set to the new domain name too.

  By default variable HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS has following value:
"preview\\.": "draft-preferred"
In such a default case any request that comes from preview.<any-delegated-domain-name> would be responded with draft version of your content.

  For test instances which are served with stage.myedx.com and stage-preview.myedx.com default key value should be changed to:
"stage-preview\\.": "draft-preferred"

If my explanation is not clear or I'm mistaken, please correct me or ask any relevant questions.
Liubov

понедельник, 16 мая 2016 г., 16:10:42 UTC+3 пользователь Anna Winklerová написал:

Anna Winklerová

unread,
May 23, 2016, 7:59:24 AM5/23/16
to General Open edX discussion
Hi,

thank you for your instructions. I had trouble putting all the little pieces from all over the docs and faq pages together but thanks to you it works now. 

So the steps I used to make it all work were (and I would suggest to edit the faq pages accordingly):

FAQ: Why doesn't the preview button work in Studio

1. Register subdomain i.e. preview.myedx.com which resolve to the same IP address as myedx.com.
2. Put the subdomain preview.myedx.com name in the PREVIEW_LMS_BASE variable, found in the cms.env.json and lms.env.json files.
3. Restart edxapp.

I didn't even need to edit /etc/hosts as mentioned here: http://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/installation/installation_options.html#set-up-ability-to-preview-units-mac-linux-only. I also left the HOSTNAME_MODULESTORE_DEFAULT_MAPPINGS with default value.

Thanks again.
-- Anna

Anna Winklerová

unread,
May 23, 2016, 8:31:16 AM5/23/16
to General Open edX discussion
Or to be accurate as to the point 1) we used CNAME record for the preview.myedx.com

LIubov Fomicheva

unread,
May 24, 2016, 4:12:12 AM5/24/16
to General Open edX discussion
Hello Anna,

I'm glad my answer helped you to solve your issue. Just one addition required: do not forget to backport your [lms,cms].env.json fixes to corresponding server-vars.yml variables (otherwise your modifications would be lost on next update of your instance); please mention this in wiki.

Liubov

Reply all
Reply to author
Forward
0 new messages