Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidekiq Route Mount doesn't rewrite URL in Rails API #3815

Closed
antodoms opened this issue Apr 4, 2018 · 4 comments
Closed

Sidekiq Route Mount doesn't rewrite URL in Rails API #3815

antodoms opened this issue Apr 4, 2018 · 4 comments

Comments

@antodoms
Copy link

antodoms commented Apr 4, 2018

Hi Team,

Ruby version: 2.4.0
Sidekiq: 5.0.4

I have a website
xyz.com -> Standalone Angular APP (Container)
xyz.com/api/ -> Standalone Rails API APP (Container)
xyz.com/api/sidekiq -> Mounted to Rails api routes.

When I try to access the /api/sidekiq it loads the data but assets are still pointing to xyz.com/sidekiq instead of xyz.com/api/sidekiq. And all when I click retry it tries to submit to xyz.com/sidekiq instead of xyz.com/api/sidekiq. Is there a way to force sidekiq to use a different path?

Is there a way to get the sidekiq web view as a seperate standalone application container?

@mperham
Copy link
Collaborator

mperham commented Apr 12, 2018

AFAIK Rack passes SCRIPT_NAME in the env to indicate the path prefix. If you call mount "/sidekiq", Sidekiq::Web, Sidekiq will think it is at /sidekiq. I'm not sure how to get the full /api/sidekiq prefix.

    def root_path
      "#{env['SCRIPT_NAME']}/"
    end

@mperham
Copy link
Collaborator

mperham commented Apr 12, 2018

I suspect the problem is that the Rails app doesn't know it is at /api/ so it doesn't prefix its own namespace to the mount path. More info:

http://www.rubydoc.info/github/rack/rack/file/SPEC

@mperham mperham closed this as completed Apr 12, 2018
@mperham
Copy link
Collaborator

mperham commented Apr 12, 2018

See also hanami/router#87

@antodoms
Copy link
Author

antodoms commented Mar 5, 2019

Thanks @mperham,

I had found a work around for this problem by tweaking Nginx Ingress Controller configuration to my rails app service. Hope this helps someone: https://stackoverflow.com/a/55004957/4289344

cheers!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants