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

mqtt.com url is working on both http. Need to disable it #1651

Open
raheem071989 opened this issue May 15, 2024 · 5 comments
Open

mqtt.com url is working on both http. Need to disable it #1651

raheem071989 opened this issue May 15, 2024 · 5 comments
Assignees
Labels
discussion This issues and pr are worth discussing help wanted Extra attention is needed
Milestone

Comments

@raheem071989
Copy link

Dear Team,

As we have configured EMQX open source, we want to disable the URL on http which is http://mqtt.com:18083 as we are running the URL on https://mqtt.com with port forwarding which is working fine as i have configured in nginx.

Could you please guide me how to disable http://mqtt.com:18083

Thanks & Regards,
Raheem.Mohammed

@raheem071989 raheem071989 added the bug Something isn't working label May 15, 2024
@ysfscream ysfscream self-assigned this May 15, 2024
@ysfscream ysfscream added help wanted Extra attention is needed discussion This issues and pr are worth discussing and removed bug Something isn't working labels May 15, 2024
@ysfscream ysfscream added this to the v1.10.0 milestone May 15, 2024
@raheem071989
Copy link
Author

Dear Team,

Could you please help on this scenario as mentioned above.

Thanks & Regards,
Raheem.Mohammed

@ysfscream
Copy link
Member

Hi there. sorry for the delayed reply.

And I think this issue seems to be related to configuring nginx. To disable HTTP access, you can try the following:

  1. Open your nginx configuration file (usually located at /etc/nginx/nginx.conf or /etc/nginx/sites-available/default).
  2. Add the following configuration to redirect HTTP to HTTPS:
server {
    listen 80;
    server_name mqtt.com;

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name mqtt.com;

    # SSL configuration
    ssl_certificate /path/to/your/certificate.crt;
    ssl_certificate_key /path/to/your/private.key;

    # Other HTTPS configurations...
}
  1. Save the changes and restart nginx:
sudo systemctl restart nginx

This will disable HTTP access by redirecting all HTTP requests to HTTPS.

@raheem071989
Copy link
Author

raheem071989 commented May 16, 2024 via email

@raheem071989
Copy link
Author

Dear Team,

Do i have changed the port , what will be the port of https in dashboard

dashboard {
listeners.http {
bind = 18083
}
}

Thanks & Regards,
Raheem.Mohammed

@ysfscream
Copy link
Member

Let me confirm your request: You want to ensure that only https://mqtt.com:18083 is accessible and http is not, correct?

As far as I know, we cannot achieve the specific goal of blocking HTTP access while allowing HTTPS access. We can only redirect HTTP to HTTPS rather than blocking HTTP access to a specific port. Since you are using Nginx, you can ensure that HTTPS is correctly configured by EMQX and simply add the Nginx rules to redirect the HTTP to HTTPS as mentioned in my previous reply.

Thanks & Regards,
Shifan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This issues and pr are worth discussing help wanted Extra attention is needed
Projects
Status: In Progress
Development

No branches or pull requests

2 participants