Skip to content

Is there a way to combine only_hosts & only? #62

Open
@akashkamboj

Description

@akashkamboj

Hello

I have a site where I want SSL only on these routes:

https://api.example.com
https://example.com/users/sign_in
https://example.com/users/sign_up

and rest URLs should run without SSL. I am not able to figure out a way to combine only_hosts and only together. Tried these:

config.middleware.use Rack::SslEnforcer,
                          only_hosts: %r{api.example.com},
                          only: %r{/users},
                          ignore: %r{/assets},
                          strict: true

also tried with mutiple statements together:

    config.middleware.use Rack::SslEnforcer,
                          except_hosts: %r{api.example.com},
                          only: %r{/users},
                          ignore: %r{/assets},
                          strict: true

    config.middleware.use Rack::SslEnforcer,
                          only_hosts: %r{api.example.com}

but no luck. any suggestion on how I can achieve it?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions