Skip to content

Commit

Permalink
Merge pull request #1209 from thunderstore-io/09-23-Add_a_version_of_…
Browse files Browse the repository at this point in the history
…ts-proxy_tool_that_uses_dev_backend

Add a version of ts-proxy tool; that uses dev backend
  • Loading branch information
Oksamies authored Sep 23, 2024
2 parents 4077a3f + 3c05066 commit 3b006e2
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tools/ts-dev-proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM nginx:alpine
WORKDIR /usr/share/nginx/html
RUN rm -rf ./*

COPY ./nginx.conf /etc/nginx/nginx.conf
6 changes: 6 additions & 0 deletions tools/ts-dev-proxy/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

services:
nginx:
build: .
ports:
- "127.0.0.1:80:80"
223 changes: 223 additions & 0 deletions tools/ts-dev-proxy/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
worker_processes 2;
worker_rlimit_nofile 20000;

events {
worker_connections 10000;
multi_accept on;
}
http {
server {
listen 80;
gzip on;
gzip_proxied any;
gzip_disable "msie6";
gzip_types
text/css
text/javascript
text/xml
text/plain
text/x-component
application/javascript
application/json
application/xml
application/rss+xml
font/truetype
font/opentype
application/vnd.ms-fontobject
image/svg+xml;
gzip_min_length 256;
gunzip on;

location = /communities {
proxy_pass http://host.docker.internal:3000/communities;
proxy_set_header Host thunderstore.temp;
proxy_set_header X-Forwarded-For $remote_addr;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location = /site.webmanifest {
proxy_pass http://host.docker.internal:3000/site.webmanifest;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location = /favicon-32x32.png {
proxy_pass http://host.docker.internal:3000/favicon-32x32.png;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location = /favicon-16x16.png {
proxy_pass http://host.docker.internal:3000/favicon-16x16.png;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location = /android-chrome-192x192.png {
proxy_pass http://host.docker.internal:3000/android-chrome-192x192.png;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /teams {
proxy_pass http://host.docker.internal:3000/teams;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /c {
proxy_pass http://host.docker.internal:3000/c;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /settings {
proxy_pass http://host.docker.internal:3000/settings;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /tools {
proxy_pass http://host.docker.internal:3000/tools;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /package/create/docs {
proxy_pass http://host.docker.internal:3000/package/create/docs;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

# location /u {
# proxy_pass http://host.docker.internal:3000/u;
# }

# location /developers {
# proxy_pass http://host.docker.internal:3000/developers;
# }

location /__remix/healthz {
proxy_pass http://host.docker.internal:3000/healthz;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

# For when running built remix
location /__remix/ {
proxy_pass http://host.docker.internal:3000/__remix/;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

# For when running dev remix
location /node_modules/ {
proxy_pass http://host.docker.internal:3000/node_modules/;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /app/ {
proxy_pass http://host.docker.internal:3000/app/;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /@vite/ {
proxy_pass http://host.docker.internal:3000/@vite/;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /@fs/ {
proxy_pass http://host.docker.internal:3000/@fs/;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /@id/__x00__sentry-release-injection-file {
proxy_pass http://host.docker.internal:3000/@id/__x00__sentry-release-injection-file;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /@id/__x00__virtual:remix/browser-manifest {
proxy_pass http://host.docker.internal:3000/@id/__x00__virtual:remix/browser-manifest;
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /@id/__x00__virtual:remix/inject-hmr-runtime {
proxy_pass http://host.docker.internal:3000/@id/__x00__virtual:remix/inject-hmr-runtime;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /@id/__x00__virtual:remix/hmr-runtime {
proxy_pass http://host.docker.internal:3000/@id/__x00__virtual:remix/hmr-runtime;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /remixhmr {
proxy_pass http://host.docker.internal:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /socket {
proxy_pass http://host.docker.internal:3000/socket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host thunderstore.temp;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location / {
proxy_pass http://host.docker.internal:81;
proxy_http_version 1.1;
proxy_set_header Host thunderstore.temp;
# proxy_ssl_name thunderstore.io;
# proxy_ssl_server_name on;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers *;
}

location /gateway/healthz {
access_log off;
return 200 "healthy\\n";
}
}
}

0 comments on commit 3b006e2

Please sign in to comment.