bolt.diy: Blocked request. This host ("boltdiy.mydomain.no")
Describe the bug
The latest release v0.0.6 works and does not have this issue. Now I am getting this error, using the main branch:
Blocked request. This host (“boltdiy.mydomain.no”) is not allowed.
To allow this host, add “boltdiy.mydomain.no” to server.allowedHosts in vite.config.js.
I run bolt.diy behind an nginx proxy using https and a valid certificate, I have tried to fix this based on the error message but cant get it to work. Downloaded the 0.0.6 release tar.gz and made a docker out of that which works perfectly. In the Dockerfile from the release source i did have to add: RUN npm install -g corepack@latest otherwise the build failed.
I’d imagine testing with localhost as hostnames when developing you wont see this error with vite, looks like others have the same issue looking at issues in vitejs on github, and for some downgrading to 6.0.8 fixes the problem.
Link to the Bolt URL that caused the error
Steps to reproduce
Run bolt.diy behind a nginx proxy, here is my configuration, renamed my domain name:
Ottodev - Bolt.new - Bolt.diy
server { listen 443 ssl;
allow 0.0.0.0/0;
deny all;
ssl_certificate /etc/letsencrypt/live/mydomain.no/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/mydomain.no/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
server_name boltdiy.mydomain.no;
client_max_body_size 20m;
location / {
proxy_pass http://aisrv.mydomain.no:5173;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_buffering off;
proxy_cache off;
chunked_transfer_encoding off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
if ( $host !~* ^(boltdiy\.mydomain\.no)$ ) {
return 444;
}
}
Expected behavior
I expected it to work like it normally does.
Screen Recording / Screenshot
No response
Platform
- Ubuntu 24.04 LTS
- Browser: Chrome
Provider Used
No response
Model Used
No response
Additional context
No response
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 1
- Comments: 15
I had the same problem hosting it with a K3s ingress fronting it.
I went to my dockerhost and editted the
vite.config.tsand added a “server” block between the define and build sections for the export defineConfig (around line 74 presently).e.g.
When i relaunched docker compose i was unblocked
Vite actually already has
__VITE_ADDITIONAL_SERVER_ALLOWED_HOSTSas an env var, it just needs to be added to the bolt dockerfile. https://vite.dev/config/server-options#server-allowedhostsHi @johnberntsen, adding your domain as an allowed host in vite config should fix this.
see reply above: https://github.com/stackblitz-labs/bolt.diy/issues/1341#issuecomment-2671130057
Basically after this line in vite.config.ts:
COPY THIS and pay attention to indents.
It works, could probably add a .env setting like ‘REVERSE_PROXY_HOST’ and use that setting to adjust this on the fly too.
@johnberntsen thanks for the reply. The main branch is more a “pre-release / beta” state, so if it works with stable and not with main, we got a bug here 😃
@xKevIsDev if you got time, can you please take a look here 😃
Hi, thanks for the reply and great video! I see you are checking out the stable branch, which im sure dont have this issue, I usually check out the latest and greatest, but reverted back to v0.0.6 - which works for me.