Support Center

Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Getting 405 error

Yakov Fain May 14, 2017 10:54PM UTC

Hello,

I was using your API from an Angular app without any issues. But about a week ago it stopped working and I'm getting the 405 error. I'm making a an HTTP Get request when the user enters the name of the city in the form. This is what I'm getting:

Request URL:http://api.openweathermap.org/data/2.5/weather?q=London&units=imperial&appid=myappID
Request Method:OPTIONS
Status Code:405 Method Not Allowed
Remote Address:192.241.169.168:80
Referrer Policy:no-referrer-when-downgrade

This is my request header:

Accept:*/*
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-US,en;q=0.8,ru;q=0.6,uk;q=0.4,la;q=0.2
Access-Control-Request-Headers:x-xsrf-token
Access-Control-Request-Method:GET
Cache-Control:no-cache
Connection:keep-alive
Host:api.openweathermap.org
Origin:http://localhost:4200
Pragma:no-cache
Referer:http://localhost:4200/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36

When I enter the same URL in the browser, the response comes back fine. Changing GET to POST didn't help.

Please advise.

Thanks

Up 0 rated Down
Yakov Fain May 14, 2017 11:10PM UTC
I didn't figure out the reason for the 405 error yet, but It's something specific to the Chrome browser. In Firefox my code works fine.
Up 1 rated Down
Yakov Fain May 15, 2017 02:37AM UTC
I fixed this issue by cleaning up cookies in Chrome. I can only assume that for some reason Chrome saved Access-Control-Request-Headers:x-xsrf-token as a cookie. Now the error 405 is gone.
Up 0 rated Down
Maxim Gushcho May 15, 2017 10:02AM UTC OpenWeatherMap Agent

Hello,

Thanks for providing this info.
We will mean it.

Post Your Public Answer

Your name (required)
Your email address (required)
Answer (required)
9eda11838f597e7a95b6a1c991dcae0a@openweathermap.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete