Coder Social home page Coder Social logo

Comments (7)

urbantrout avatar urbantrout commented on May 19, 2024 6

I have adopted @firstred’s answer for nginx:

location /search {
  rewrite /search/(.*) /$1 break;
  proxy_pass http://127.0.0.1:7700;
}

location / {
  if ($http_referer ~* ^.*/search/.*$ ) {
    proxy_pass  http://127.0.0.1:7700;
  }
}

from mini-dashboard.

firstred avatar firstred commented on May 19, 2024 4

Not sure yet what the nginx equivalent is, but I managed to solve the problem with Caddy by matching the Referer header.
If the request's Referer header contains /search/, it will strip /search from the path and effectively serve css js etc. from root.

route {
  ##### Ensure trailing slash
  redir /search /search/

  ##### Serve Meilisearch from a subfolder, by matching the path
  @meilisearch path /search/*
  ##### Serve assets from the subfolder, by matching the HTTP Referer header
  @meilisearch_assets header Referer */search/*

  handle @meilisearch {
    uri strip_prefix /search
    header X-Forwarded-Proto {scheme}
    header X-Forwarded-Host {host}
    reverse_proxy meilisearch:7700
  }

  handle @meilisearch_assets {
    uri strip_prefix /search
    header X-Forwarded-Proto {scheme}
    header X-Forwarded-Host {host}
    reverse_proxy meilisearch:7700
  }
}

from mini-dashboard.

bidoubiwa avatar bidoubiwa commented on May 19, 2024 1

I'm not sure this is something we want as a curl on /search I think would return the HTML page. Though I'm sure there is a solution I don't have the required knowledge to play with path and redirections.

from mini-dashboard.

firstred avatar firstred commented on May 19, 2024 1

Great! @urbantrout thanks a lot for sharing the nginx version!

from mini-dashboard.

mskyttner avatar mskyttner commented on May 19, 2024

Related meilisearch/product#295

from mini-dashboard.

gmourier avatar gmourier commented on May 19, 2024

Do we have any news on this? It looks like a bug fix more than a new feature to me.

The problem with changing to href is that now the mini dashboard is accessible on every sub-route on not only the root of the meilisearch instance.

@bidoubiwa This is the most direct solution but do we have another one at hand?

from mini-dashboard.

mdubus avatar mdubus commented on May 19, 2024

Thanks a lot for your answers and suggestions 🙏

I'll now close this issue as this can be fixed with the nginx configuration.

Have a nice day ☀️

from mini-dashboard.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.