Troubleshooting
Invalid Host Header error
Host header checks are a security measure in production environments. However, some frameworks perform them also in dev mode and only accept localhost
in the Host header. Since LocalCan sets the Host header to either your local domain or Public URL, you should consult your framework's documentation on how to disable host check in development, or add your domain to the allowed hosts.
Examples:
Angular
In Angular, you can disable host checking by modifying the angular.json
file:
angular.json
{
...
"projects": {
"your-project-name": {
"architect": {
"serve": {
"options": {
"disableHostCheck": true,
...
}
}
}
}
}
}
or run your app with a flag:
ng serve --disable-host-check
Django (Python)
In Django, you can modify the ALLOWED_HOSTS
in your settings.py
file:
settings.py
ALLOWED_HOSTS = ['myapp.local', 'localhost', '127.0.0.1', ...]
For other frameworks, please refer to their documentation.
© 2024 LocalCan™. All rights reserved.