0

I have very weird issue of 404 page not found. I already have custom 404 page but my app render its own 404 page- I guess for some request my app does not get any hit for example - (1) http://www.mymster.com/neerajsridhar renders default ngix 404 page,but (2) http://www.mymster.com/khanimdads renders custom 404 page

The main issue is not custom 404 page but the error which is: - For point (1) above there is record in my DB ('neerajsridhar' is username in my DB), it works fine on my local machine but not in production mode.

Few inputs which may help in fixing this a) I have used fragment caching for above page b) Above page had 301 permanent c) Environment is - Rails 4, ruby 2, unicorn, nginx and pagespeed.

http://www.mymster.com/stack/once-upon-a-time-in-mexico-12061 - this page do not have any 301 permanent redirect so it should work, but does not. Any help would be appreciated.

Imdad
  • 41
  • 7
  • Could you add part of your nginx configuration? Because first 404 error is nginx error, so I presume your request in the second case was successfully passed through nginx to app, whereas in the first something had happened before. It also may be caused by nginx cache. – Nick Roz May 26 '15 at 11:35
  • Thanks for your response, yes i doubt it may caching issue but not sure hot to fix it, here is the part of nginx configs https://gist.github.com/khanimdad/e34a85afc5ab904fcce2 – Imdad May 27 '15 at 13:02
  • Do u have special part for 404 page in nginx config? Try [proxy_cache_valid](http://nginx.org/ru/docs/http/ngx_http_proxy_module.html#proxy_cache_valid) – Nick Roz May 27 '15 at 13:13
  • Look at [How to clear the cache of nginx](http://stackoverflow.com/questions/6236078/how-to-clear-the-cache-of-nginx) – Nick Roz May 27 '15 at 13:14
  • Hi Николай, here is sites-available https://gist.github.com/khanimdad/e34a85afc5ab904fcce2 and nginx.conf - https://gist.github.com/khanimdad/fbb6063fc239eb6f29f5, i already tried sendfile off, and "proxy_cache_valid 404 1m;" as you can see it in config file, but yet no luck, and i do not think i have special part for 404. – Imdad May 28 '15 at 00:50
  • Have you tried clearing all the cache? – Nick Roz May 28 '15 at 08:52
  • Are you using nginx on local machine? – Nick Roz May 28 '15 at 08:53
  • No am not using nginx on local machine, and am not sure how to clear the cache – Imdad May 28 '15 at 13:22
  • So then problem is definitely in nginx. `sudo rm -rf /data/nginx/cache/` depending on where your nginx cache directory is – Nick Roz May 28 '15 at 13:44
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/79014/discussion-between---and-imdad). – Nick Roz May 28 '15 at 13:44

0 Answers0