Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How to handle dev server base behind a nginx inner sub directory #20796

Unanswered
IamIpanda asked this question in Q&A
Discussion options

I have a dev code-server with prefix a/b, nginx like that:

location /a/b/ {
 proxy_set_header Host $host;
 proxy_set_header Upgrade $http_upgrade;
 proxy_set_header Connection upgrade;
 proxy_set_header Accept-Encoding gzip;
 proxy_redirect http://$host https://$host/a/b;
 proxy_buffering off;
 proxy_pass http://<ip>:8080/;
}

Now I enable port forwading on that code server to forward dev server 5173, finally I get a url like that:
https://HOST/a/b/proxy/5173/

Now it asking for
https://HOST/@vite/client.
Obviously it don't exist. How can I make that correctly point to https://HOST/a/b/proxy/5173/@vite/client?
I have multiple dev server on that HOST so I don't want configure it directly on nginx.

Current vite.config.ts:

import { defineConfig } from 'vite'
import preact from '@preact/preset-vite'
export default defineConfig({
 plugins: [preact()],
 server: {
 host: "0.0.0.0",
 allowedHosts: ["HOST"]
 },
 base: "./"
})

I tried several settings for base and it seems the vite cannot correctly realize the nginx prefix a/b.

You must be logged in to vote

Replies: 1 comment

Comment options

change base to /a/b in vite config

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /