0

I have been loading UIWebViews with a set of URL's for a long time while testing my app with no problem. Now I get 502 Bad Gateway Error message when I load my UIWebView.

The URL's I use all came from the same source and all start with:

http://www.gijon.es/eventos/show/

Some URLs are for example:

http://www.gijon.es/eventos/show/21514-ciclo-ciencia-x-cine http://www.gijon.es/eventos/show/20611-mercado-ecologico-y-artesano

  • I have tested the URLs from my browser and they work Ok.
  • I have tested doing a Log that this are actually the URLs just before creating the request.
  • I have made a testApplication with just a UIWebView loading this URL's and it fails the she way my app does.
  • Any other URL like http://google.com loads nicely.

How can I debug this problem? Should it be a problem with the remote server? Can it be a problem in my configuration?

David Casillas
  • 1,801
  • 1
  • 29
  • 57

1 Answers1

1

The website is configured to handle requests differentely according to the browsers user agent.

So when you access it with UIWebView you are sending as a user agent iPhone, which takes you to a different page on the site. Due to miscofiguration from their webserver you are seeing a 502 Bad Gateway error (probably they are running NginX).

To verify this, open Firefox, download the User Agent Switcher addon, select as a user agent iPhone 3.0, then open http://www.gijon.es/eventos/show/21514-ciclo-ciencia-x-cine

You will see the 502 bad gateway error

If you want to solve this, you can modify the default UIWebView user agent (set it to safari something). The way to do this is here

Community
  • 1
  • 1
Lefteris
  • 14,550
  • 2
  • 56
  • 95