Hi I have an html template for switching languages on my site:
<form action="{{ SITE_URL }}i18n/setlang/" name="postlink" method="post">{% csrf_token %}
<ul class="lang">
<li class="lang">
{% for lang in LANGUAGES %}
{% if lang.0 != LANGUAGE_CODE %}
<input type="hidden" name="language" value="{{ lang.0 }}">
<a class="active" href=# onclick="submitPostLink()">{{ lang.1 }}</a>
{% else %}
{{ lang.1 }}
{% endif %}
{% if forloop.last %}{% else %} | {% endif %}
{% endfor %}
</li>
</ul>
</form>
All this works fine on the dev server and in production and in production at the normal url of http://www.mysite.com/project/
However, if I try project.mysite.com or mysite.com.project I get my home page as normal but changing the language brings up the 403 Forbidden failure.
Do I need to define the root url variations I need for setlang somewhere?
Any help much appreciated.
Since these urls are running on different subdomains, you should check the domain setting for the CSRF cookie
CSRF_COOKIE_DOMAIN: https://docs.djangoproject.com/en/1.3/ref/contrib/csrf/#subdomains