Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dev-server HTTP Error 403: Forbidden

After updating from 1.7.5 (where everything worked fine) I'm getting a HTTP Error 403: Forbidden when trying to open any sites via localhost. Strange thing is I have pretty much the same setup at home as here at work and everything works there... Might be an issue with proxy server we're using at work, since that's the only difference I can think of? Here's the error log I'm getting, so if anyone knows what's going on please help (;

Traceback (most recent call last):
  File "U:\Dev\GAE\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 1302, in communicate
    req.respond()
  File "U:\Dev\GAE\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 831, in respond
    self.server.gateway(self).respond()
  File "U:\Dev\GAE\lib\cherrypy\cherrypy\wsgiserver\wsgiserver2.py", line 2115, in respond
    response = self.req.server.wsgi_app(self.env, self.start_response)
  File "U:\Dev\GAE\google\appengine\tools\devappserver2\wsgi_server.py", line 246, in __call__
    return app(environ, start_response)
  File "U:\Dev\GAE\google\appengine\tools\devappserver2\request_rewriter.py", line 311, in _rewriter_middleware
    response_body = iter(application(environ, wrapped_start_response))
  File "U:\Dev\GAE\google\appengine\tools\devappserver2\python\request_handler.py", line 89, in __call__
    self._flush_logs(response.get('logs', []))
  File "U:\Dev\GAE\google\appengine\tools\devappserver2\python\request_handler.py", line 220, in _flush_logs
    apiproxy_stub_map.MakeSyncCall('logservice', 'Flush', request, response)
  File "U:\Dev\GAE\google\appengine\api\apiproxy_stub_map.py", line 94, in MakeSyncCall
    return stubmap.MakeSyncCall(service, call, request, response)
  File "U:\Dev\GAE\google\appengine\api\apiproxy_stub_map.py", line 320, in MakeSyncCall
    rpc.CheckSuccess()
  File "U:\Dev\GAE\google\appengine\api\apiproxy_rpc.py", line 156, in _WaitImpl
    self.request, self.response)
  File "U:\Dev\GAE\google\appengine\ext\remote_api\remote_api_stub.py", line 200, in MakeSyncCall
    self._MakeRealSyncCall(service, call, request, response)
  File "U:\Dev\GAE\google\appengine\ext\remote_api\remote_api_stub.py", line 226, in _MakeRealSyncCall
    encoded_response = self._server.Send(self._path, encoded_request)
  File "U:\Dev\GAE\google\appengine\tools\appengine_rpc.py", line 393, in Send
    f = self.opener.open(req)
  File "U:\Dev\Python\lib\urllib2.py", line 410, in open
    response = meth(req, response)
  File "U:\Dev\Python\lib\urllib2.py", line 523, in http_response
    'http', request, response, code, msg, hdrs)
  File "U:\Dev\Python\lib\urllib2.py", line 448, in error
    return self._call_chain(*args)
  File "U:\Dev\Python\lib\urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "U:\Dev\Python\lib\urllib2.py", line 531, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
HTTPError: HTTP Error 403: Forbidden
INFO     2013-04-19 12:28:52,576 server.py:561] default: "GET / HTTP/1.1" 500 -
INFO     2013-04-19 12:28:52,619 server.py:561] default: "GET /favicon.ico HTTP/1.1" 304 -

Also, the launcher throws an error when closing:

Traceback (most recent call last):
  File "launcher\mainframe.pyc", line 327, in OnStop
  File "launcher\taskcontroller.pyc", line 167, in Stop
  File "launcher\dev_appserver_task_thread.pyc", line 82, in stop
  File "launcher\taskthread.pyc", line 107, in stop
  File "launcher\platform.pyc", line 397, in KillProcess
pywintypes.error: (5, 'TerminateProcess', 'Access is denied.')
like image 551
Sasxa Avatar asked Apr 19 '13 10:04

Sasxa


1 Answers

I had this very same issue with my MacOSX when using a proxy server using Google App Engine Launcher 1.8.6. Apparently there's an issue with "proxy_bypass" on "urllib2.py".

There are two possible solutions:

  1. Downgrade to 1.7.5, but, who wants to downgrade?
  2. Edit "[GAE Instalattion path]/google/appengine/tools/appengine_rpc.py" and look for the line that says

    opener.add_handler(fancy_urllib.FancyProxyHandler())

In my computer it was line 578, and then put a hash (#) at the beginning of the line, like this:

`#opener.add_handler(fancy_urllib.FancyProxyHandler())`

Save the file, stop and then restart your application. Now dev_appserver.py shouldn't try to use any proxy server at all.

If your application uses any external resources like a SOAP Webservice or something like that and you can't reach the server without the proxy server, then you'll have to downgrade. Please keep in mind that external javascript files (like facebook SDK or similar) are loaded from your browser, not from your application.

Since I'm not using any external REST or SOAP services it worked for me!

Hopefully it will work for you as well.

like image 183
erickthered Avatar answered Sep 20 '22 13:09

erickthered