Server Side Includes syntax no longer works with Apache 2.4 - ssi

I am using this syntax to check for the current document name with Server Side Includes (SSI):
<!--#if expr="$DOCUMENT_NAME = /index.shtml/" -->
<ul id="menu">
...
</ul>
<!--#endif -->
Unfortunately, this no longer works with Apache 2.4 (it used to work with version 2.2, though!).
What am I missing here? How can I get this to work?

Related

Jquery Cycle2 won't produce slideshow

I'm trying to implement the cycle2 plugin with jquery on an HTML page.
I've used the site http://jquery.malsup.com/cycle2 as a guide
I downloaded (copied) the file jquery.cycle2.js I placed it on the server in on the server in the location public_html/cycle2/jquery.cycle2.js
In my HTML page's Header section I added the lines:
<!-- include jQuery library -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<!-- include Cycle2 -->
<script src="cycle2/jquery.cycle2.js"></script>
Then, in the HTML page's BODY I added:
<div class="cycle-slideshow">
<img src="cycle_images/image1.jpg" alt="Image1"/>
<img src="cycle_images/image2.jpg" alt="Image2"/>
<img src="cycle_images/image3.jpg" alt="Image3"/>
</div>
The guide doesn't give a css-type example for the class "cycle-slideshow". Instead it says that by using that class in the DIV tag it will auto-activate the slideshow.
This doesn't seem to activate the slideshow. Instead it lays out the images out in three rows, one row after another.
Any idea what I'm doing wrong to activate the cycle2 slideshow?
The problem was with the HTTP:// on the server line. Since the Cycle2 documentation was published, the GOOGLEAPIS sever must have obtained a certificate, making it HTTPS. The mismatch between HTTP and HTTPS caused the plugin to fail. The working code now reads:
<!-- include jQuery library -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<!-- include Cycle2 -->
<script src="cycle2/jquery.cycle2.js"></script>
It seems to me that it's safer to remove "HTTP" or "HTTPS" and just being the server line with "//".

Django + Extjs 5.1.1

I have a strange django error, that i would you to help me please.
The error occurs when I try to load django templates.
I work with Sencha ver 5.1.1 and Django ver 1.8.2.
When I try to load index.html, a file created by Sencha Cmd file without django (directly), with hard path like this:
<script id="microloader"
type="application/javascript"
src="/frontend/extjs/bootstrap.js">
</script>
It works as excepted.
But, if I load index.html with django with as a templates who look like this:
{% load staticfiles %}
<script id="microloader"
type="application/javascript"
src="{% static "bootstrap.js" %}">
</script>
On firefox it show the following error :
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
manifest = Ext.manifest = JSON.parse(result.content);
bootstrap.js col:50 line 1513
Does anyone have any solution?
it is appear that firefox CAN NOT run with out web security as chrome does.
Because of that all my testing was unable to run and fail.
If you running test inside your lab you may want to use chrome as the
following :
"chrome --disable-web-security"
Please note , this ONLY FOR TESTING !!!! not for production.
After I realize that my django finally run as expected and load the index.html as a templates as i need.
Thank all for all your effort to help

What's wrong with this SSI

I'm having trouble with SSI. It seems like I don't get to work the most basic command:
<!--#if expr="${title}" -->
<!--#echo var="title" -->
<!--#endif -->
I think it's obvious what I want to do and I can't find what's wrong with this piece of code. However SSI says [an error occurred while processing this directive].
The echo without the if block works fine.
I've found the error:
Apache changed its syntax for SSI conditionals with Version 2.3 or something so now it has to look like that:
<!--#if expr='-n v("title")' -->
<!--#echo var="title" -->
<!--#endif -->

Flask import static resources

The problem: I get a 404 when I access static resources from any route other than '/'.
I have an image called volume.png in my static folder in my Flask application. When I route my main page to '/' using #app.route('/') it finds the image fine, and I can display the image when I hit localhost:5000/static/images/volume.png. But when I use any other link, for example, '/s', it says it can't find the image in s/static/images/volume.png. Even when I create an s directory and copy the static directory to it, I get a 404 when I type localhost:5000/s/static/images/volume.png. I've considered using Flask-Assets, but there doesn't appear to be much documentation or examples. What's a good way to make sure my routes have access to the static resources?
You need to qualify the path to your image in your HTML (or CSS):
<!-- This will break in the way you describe -->
<img src="static/images/volume.png" />
<!-- This will not -->
<img src="/static/images/volume.png" />
<!-- Nor will this (assuming you are using a Jinja template) -->
<img src="{{ url_for('static', filename='images/volume.png') }}" />
The reason for this is because of the way that user-agents are required to resolve relative paths for URIs (see section 5.1 of RFC 3968 for the details).
Using static/images/volume.png results in the following path at /:
scheme://host.name/static/images/volume.png
and the following at /s:
scheme://host.name/s/static/images/volume.png
as you have discovered. By ensuring that you provide an absolute path component (at the very least) for your resources, you ensure that the browser will merge your provided path with only scheme and host.name, rather than with scheme, host.name and path.

How can I make sure that the urls work the same in built-in web-server and Apache

The situation is:
I have Apache with mod_python on windows xp and my django project is not in the document root.
The Django project location is defined with the tag. The django.root ist also defined there.
All the urls work fine in the built-in server but unfortunately not in Apache. In some urls, especially the ones not pointing to the admin do not work. The django.root part gets cut off.
How can I avoid this ?
One solution could be to set the django-project into Apache's document-root. Are there other solutions?
Django will use the django.root part correctly if you compose links in the template files with {% url %} tags and by calling reverse() in your HTTPResponseRedirects() calls.
Its value is stored in HttpRequest - request.META['SCRIPT_NAME'] and you can use it also in templates with:
{% if user.is_staff %}
<li>
Administration
</li>
{% endif %}