I've set up a proxy to redirect a wildcard for my blog. Would like to have some intentional handling around a 404 error if the path I'm passing through doesn't have a destination and gets a 404.
What's the best way to go about this?
config.middleware.insert(0, Rack::ReverseProxy) do
reverse_proxy /^\/blog(\/?.*)$/, 'http://blog.mysite.com$1'
end
In this example, let's say the following are valid:
/blog (goes to http://blog.mysite.com)
/blog/my-article (goes to http://blog.mysite.com/my-article)
But the following is NOT valid
/blog/does-not-exist (gets a 404 from http://blog.mysite.com/does-not-exist)
I'd like to catch that error and redirect to a page in my Rails app (not something behind the reverse proxy). Is this possible? and how?
I've set up a proxy to redirect a wildcard for my blog. Would like to have some intentional handling around a 404 error if the path I'm passing through doesn't have a destination and gets a 404.
What's the best way to go about this?
In this example, let's say the following are valid:
/blog(goes tohttp://blog.mysite.com)/blog/my-article(goes tohttp://blog.mysite.com/my-article)But the following is NOT valid
/blog/does-not-exist(gets a 404 fromhttp://blog.mysite.com/does-not-exist)I'd like to catch that error and redirect to a page in my Rails app (not something behind the reverse proxy). Is this possible? and how?