Commit d20601d2 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

update: readme

parent d921f3da
Pipeline #6123 passed with stage
in 1 minute and 25 seconds
......@@ -267,9 +267,9 @@ INSTALLED_APPS = [
]
```
## 301 on domain mismatch
## 302 on domain mismatch
To enable 301 redirection on domain mismatch, add `djangoldp.middleware.AllowOnlySiteUrl` on `MIDDLEWARE`
To enable 302 redirection on domain mismatch, add `djangoldp.middleware.AllowOnlySiteUrl` on `MIDDLEWARE`
This ensure that your clients will use `SITE_URL` and avoid mismatch betwen url & the id of a resource/container
......
......@@ -8,8 +8,8 @@ class AllowOnlySiteUrl:
self.get_response = get_response
def __call__(self, request):
response = self.get_response(request)
if(is_safe_url(request.get_raw_uri(), allowed_hosts=settings.SITE_URL)):
response = self.get_response(request)
return response
else:
return redirect('{}{}'.format(settings.SITE_URL, request.path))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment