Facing intermittent 404 issue when calling Rails API

江枫思渺然 提交于 2019-12-20 04:56:34

问题


I have banged my head on this for 2 days now and i dint find any luck yet. Looking for help on this.

The issue:

Front End makes 10 similar XHR requests ( for different users ) to my Rails API and few of the requests randomly fails with 404 status code.

My Observations:

  • If i make the same request again, It passes.
  • I dont see any trace of 404 requests even hitting my server ( using logs ).
    • I do see different response headers for 200 and 404 ( mentioned below ) and i see cowboy ( https://github.com/heroku/cowboyku, https://github.com/heroku/vegur) server for 404 requests. I run my rails production with thin web server.

My theory is that, As few of my requests are not able to hit my thin server, they are getting 404. Now, the confusion is, Why is it hitting cowboy

200 Status Code

404 Status Code

[EDITS] response payload for 404 errors is something like below.

<!DOCTYPE html>
    <html>
      <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta charset="utf-8">
        <title>No such app</title>
        <style media="screen">
          html,body,iframe {
            margin: 0;
            padding: 0;
          }
          html,body {
            height: 100%;
            overflow: hidden;
          }
          iframe {
            width: 100%;
            height: 100%;
            border: 0;
          }
        </style>
      </head>
      <body>
        <iframe src="//www.herokucdn.com/error-pages/no-such-app.html"></iframe>
      </body>
    </html>

来源:https://stackoverflow.com/questions/56977433/facing-intermittent-404-issue-when-calling-rails-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!