2

I am trying to create a local proxy server in django, but I am unable to redirect the proxy requests to my view. In my system settings, I have set my django server as the proxy.

I am getting logs as such in my server:

[27/Dec/2016 22:01:40]"CONNECT www.google.co.in:443 HTTP/1.1" 404 1783

My URL configuration is:

url(r'^.*$', RedirectView.as_view(pattern_name=u'homepage', permanent=False))

What am I doing wrong while trying to redirect any browser request to my view?

jsea
  • 3,859
  • 1
  • 17
  • 21
Aakash
  • 23
  • 1
  • 3
  • You mean you want to redirect to google.com when `/` ? – Raja Simon Dec 28 '16 at 07:09
  • When I hit google.com in my browser, the browser is forwarding the request to my proxy server. I want my server to pick up that request, hit google and return the response back to the browser.The problem is I don't know how to configure the urls.py so that a proxy request finds its way to my view. – Aakash Dec 28 '16 at 08:19
  • django isn't suited for this. What exactly are you trying to achieve? – e4c5 Dec 29 '16 at 12:41
  • I am trying to build a content filtering proxy server so that all requests and responses pass through my django server. – Aakash Dec 29 '16 at 18:17

1 Answers1

2

you are comparing a proxy server with an wsgi based http server, when you run a Django development server ( python manage.py runserver), Django runs a wsgi compatible http server, that handles only requests ( URIs ?), not a tcp request content, so you need a http proxy server that copies the request buffer to the application server atleast.There are many available but if you need to implement own, there is already an answered question here

Renjith Thankachan
  • 4,178
  • 1
  • 30
  • 47