You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My company's main web application (heroku) and marketing site (wordpress) are served at the same subdomain (www). The root/empty path (e.g. https://www.mysite.com) and some other whitelisted paths are reverse-proxied to wordpress, while the rest are served by a Rails app.
We wanted to make it such that if a request comes in for the root path AND they have a specific cookie (a session cookie for our app), redirect them into the application. Otherwise, reverse-proxy as usual to wordpress.
Solution
Currently I've monkey-patched this gem to support this use-case:
moduleRackReverseProxyclassRoundTripprivatealias_method:proxy_original,:proxydefproxyreturnapp.call(env)ifuri.nil?ifoptions[:custom_response]response=options[:custom_response].call(source_request)returnresponseifresponseendproxy_originalendendend# In config.ru:custom_response=procdo |request|
[302,{'Location'=>"#{request.base_url}/app"},[]]ifrequest.cookies['_my_app_session']endreverse_proxy(/^$/,passback_host,:custom_response=>custom_response)
Just wondering if this is something other people have run into and/or this is something you'd want to bake into this gem. I'm happy turn this into a PR if so.
The text was updated successfully, but these errors were encountered:
Use-case
My company's main web application (heroku) and marketing site (wordpress) are served at the same subdomain (www). The root/empty path (e.g. https://www.mysite.com) and some other whitelisted paths are reverse-proxied to wordpress, while the rest are served by a Rails app.
We wanted to make it such that if a request comes in for the root path AND they have a specific cookie (a session cookie for our app), redirect them into the application. Otherwise, reverse-proxy as usual to wordpress.
Solution
Currently I've monkey-patched this gem to support this use-case:
Just wondering if this is something other people have run into and/or this is something you'd want to bake into this gem. I'm happy turn this into a PR if so.
The text was updated successfully, but these errors were encountered: