Changing Path for Typesense Server Configuration

TLDR Karthik wanted to change the path in Typesense server config. Jason suggested updating the nodes and using Nginx reverse proxy for the desired configuration.

Photo of Karthik
Karthik
Wed, 22 Mar 2023 15:19:16 UTC

Jason, Is there any way to change the path from this to `` this `` ```import TypesenseInstantsearchAdapter from "typesense-instantsearch-adapter"; let TYPESENSE_SERVER_CONFIG = { apiKey: "xyz", nodes: [ { host: "localhost", port: 8108, protocol: "http", }, ], connectionTimeoutSeconds: 1, numRetries: 8, }; export const typesenseAdapter = new TypesenseInstantsearchAdapter({ server: TYPESENSE_SERVER_CONFIG, additionalSearchParameters: { query_by: "CAS_ID,Synonyms,Molecular_Weight", queryByWeights: "4,2,2", numTypos: 3, typoTokensThreshold: 1, }, }); export const searchClient = typesenseAdapter.searchClient;``` above code, I wrote in next.js - typesenseadapter.js

Photo of Jason
Jason
Wed, 22 Mar 2023 15:36:28 UTC

You can update the nodes config to this: ```nodes: [ { host: "localhost", path: "/typesense", port: 8108, protocol: "http", },```

Photo of Karthik
Karthik
Wed, 22 Mar 2023 15:49:22 UTC

after adding the prop path I am getting an error - 400 { "message": "Not Found"}

Photo of Jason
Jason
Wed, 22 Mar 2023 15:54:12 UTC

Could you look at the browser’s network inspector and share the actual path being generated?

Photo of Jason
Jason
Wed, 22 Mar 2023 15:54:34 UTC

Wait do you already have Typesense running behind `` via a reverse proxy?

Photo of Karthik
Karthik
Wed, 22 Mar 2023 15:59:33 UTC

I am trying on my local system Linux, and also 8108 port is running on my system

Photo of Jason
Jason
Wed, 22 Mar 2023 16:00:36 UTC

See our previous thread about first running Typesense on that path via a reverse proxy:

Photo of Jason
Jason
Wed, 22 Mar 2023 16:00:50 UTC

Only once you have that working, will changing the config in the adapter work

Photo of Karthik
Karthik
Wed, 22 Mar 2023 16:01:15 UTC

Ok

Photo of Karthik
Karthik
Wed, 22 Mar 2023 16:02:10 UTC

I will try to repopulate the data with new configuration using typesense npm

Photo of Karthik
Karthik
Wed, 22 Mar 2023 20:28:30 UTC

Jason how can I add a path to the typesense server configuration

Photo of Jason
Jason
Wed, 22 Mar 2023 20:57:06 UTC

Typesense does not support this natively

Photo of Jason
Jason
Wed, 22 Mar 2023 20:57:17 UTC

So it will only listen to the root path

Photo of Jason
Jason
Wed, 22 Mar 2023 20:57:33 UTC

You have to put nginx in front of Typesense if you want to serve from a sub-path