Skip to content

Commit

Permalink
Restrict NGINX path port range to 3000-3999 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasuillard authored Apr 5, 2024
1 parent ce324e8 commit 4c32c89
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ This image built based on [theasp/novnc](https://github.com/theasp/docker-novnc/

http://localhost:3000/path/to/mock

> Only port range in 3000-3999 will be forwarded by configuration, otherwise NGINX will respond with **404 Not Found**.
## 📔 Usage

You can try this image with Docker Compose by simply checking it out and running `docker compose up --build`. For more details, please check `docker-compose.yaml` file.
Expand Down
2 changes: 1 addition & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ http {
server {
listen 0.0.0.0:80;

location ~ ^/(?<port>[0-9]+)(?:/|$) {
location ~ "^/(?<port>3\d{3})(?:/|$)" {
rewrite "^/\d{4}(?:/(.*))?" /$1 break;
proxy_pass http://127.0.0.1:$port;
}
Expand Down

0 comments on commit 4c32c89

Please sign in to comment.