smocker-dev / smocker

Smocker is a simple and efficient HTTP mock server and proxy
https://smocker.dev
MIT License
1.13k stars 59 forks source link

SMOCKER_CONFIG_BASE_PATH not used to serve assets #264

Closed mlcdf closed 1 year ago

mlcdf commented 1 year ago

Hello! :)

I'm running smocker behind a nginx reverse proxy. The API works fine, but the UI assets won't load because their path is not prepend with SMOCKER_CONFIG_BASE_PATH.

Here's the content of the index.html page (with SMOCKER_CONFIG_BASE_PATH=/smocker):

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <link rel="icon" href="assets/favicon.faca1f95.ico">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="description" content="Smocker is a simple and efficient HTTP mock server">
    <link rel="apple-touch-icon" href="assets/logo180.16b61295.png">
    <title>Smocker</title>
    <base href="/smocker">
    <link rel="stylesheet" href="assets/index.f126532d.css">
    <script>window.basePath = "\/smocker", window.version = "0.18.2";</script>
</head>

<body>
    <div id="root"></div>
    <script type="module" src="assets/index.cea503c2.js"></script>
    <script src="assets/index.127cffb2.js" nomodule="" defer></script>
</body>

</html>

As you can see, the <base href="/smocker"> is correct, but not the assets paths.

gwleclerc commented 1 year ago

can you try with SMOCKER_CONFIG_BASE_PATH=/smocker/ ? Because assets path will be automatically concat with the <base href="..."/> by your browser so this would give here /smockerassets/...

mlcdf commented 1 year ago

The problem was between the keyboard and the chair... Thank you!