Comments (7)
@jasonbosco Added via 523c142
Docker image 0.7.1
is also published:
https://hub.docker.com/r/typesense/typesense/tags/
from typesense.
Almost works. It now returns a 200, but looks like it's missing the content-type header in the list of allowed headers:
Network Request:
Console:
from typesense.
According to the spec the server should send the value of the Access-Control-Request-Headers
back in Access-Control-Allow-Headers
if it accepts them. I am already doing that. Although I see that the Access-Control-Request-Headers
is being sent in the screenshot, somehow the server is not finding it and hence the empty response.
Not sure why this is happening since it works for me in CURL... Can you try:
$ curl -H "Origin: http://example.com" \ ‹ruby-2.2.5@typesense›
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: x-typesense-api-key, Content-Type" \
-X OPTIONS --verbose \
http://localhost:8108/collections
* Trying ::1...
* TCP_NODELAY set
* Connection failed
* connect to ::1 port 8108 failed: Connection refused
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8108 (#0)
> OPTIONS /collections HTTP/1.1
> Host: localhost:8108
> User-Agent: curl/7.53.1
> Accept: */*
> Origin: http://example.com
> Access-Control-Request-Method: POST
> Access-Control-Request-Headers: x-typesense-api-key, Content-Type
>
< HTTP/1.1 200 OK
< Date: Tue, 02 Jan 2018 02:27:49 GMT
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS
< Access-Control-Allow-Headers: x-typesense-api-key, Content-Type
< Access-Control-Max-Age: 86400
< transfer-encoding: chunked
<
* Connection #0 to host localhost left intact
from typesense.
@kishorenc Interestingly, when I try that curl out, I get blank value for headers:
$ curl -H "Origin: http://localhost:8108" \
> -H "Access-Control-Request-Method: POST" \
> -H "Access-Control-Request-Headers: x-typesense-api-key, Content-Type" \
> -X OPTIONS --verbose \
> http://localhost:8108/collections
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8108 (#0)
> OPTIONS /collections HTTP/1.1
> Host: localhost:8108
> User-Agent: curl/7.54.0
> Accept: */*
> Origin: http://localhost:8108
> Access-Control-Request-Method: POST
> Access-Control-Request-Headers: x-typesense-api-key, Content-Type
>
< HTTP/1.1 200 OK
< Date: Tue, 02 Jan 2018 04:52:24 GMT
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS
< Access-Control-Allow-Headers:
< Access-Control-Max-Age: 86400
< transfer-encoding: chunked
<
* Connection #0 to host localhost left intact
Another thing I noticed is that if there's only one header passed in the request, say just Content-Type
then the server returns that header:
$ curl -H "Origin: http://localhost:8108" \
> -H "Access-Control-Request-Method: POST" \
> -H "Access-Control-Request-Headers: Content-Type" \
> -X OPTIONS --verbose \
> http://localhost:8108/collections
* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8108 (#0)
> OPTIONS /collections HTTP/1.1
> Host: localhost:8108
> User-Agent: curl/7.54.0
> Accept: */*
> Origin: http://localhost:8108
> Access-Control-Request-Method: POST
> Access-Control-Request-Headers: Content-Type
>
< HTTP/1.1 200 OK
< Date: Tue, 02 Jan 2018 04:54:19 GMT
< Connection: keep-alive
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Methods: POST, GET, DELETE, PUT, PATCH, OPTIONS
< Access-Control-Allow-Headers: Content-Type
< Access-Control-Max-Age: 86400
< transfer-encoding: chunked
<
* Connection #0 to host localhost left intact
from typesense.
@kishorenc Following up from this comment, I tested out typesense/typesense:0.8-api-changes
. We're one step closer...
I'm now running into this issue:
The browser is sending the request and receiving a response, but it's refusing to process the response for the GET request because there are no Access-Control-*
headers in the response to the GET request. Only the OPTIONS request's response has those headers:
Looking at the MDN documentation for CORS, Access-Control headers need to be mirrored on the actual GET/POST requests' responses in addition to the pre-flight OPTIONS request.
from typesense.
@jasonbosco Okay, Access-Control-Allow-Origin
is now sent in all responses when CORS is enabled. I've republished the typesense/typesense:0.8-api-changes
docker image with that change.
from typesense.
Alright! Works fine now.
from typesense.
Related Issues (20)
- [Feature Request] Support updating metadata of a collection
- [Feature Request] Ability to integrate results from custom Semantic Search server e.g. ColbertV2 or RAGatouille
- Surprising behavior on ids containing URL-unsafe characters HOT 2
- Question: Is it possible to disable peering and run in standalone mode? HOT 1
- [Feature Request] Add support for faceting on joined reference fields HOT 1
- [Feature request] Support UPSERT by query
- geopoint doesn't accept the int as latitude and langitute
- [Feature Request] Filter Caching
- wrong facet_counts, missing facet values with Semantic Search
- Typesense uses host machine memory stats when running in Docker
- Memory Corruption in `fuzzy_search_fields`
- [Feature request] Add "cleanup" parameter to snapshot operation
- [BUG] Lazy filter performance issue when more than 10 terms in a filter_by field HOT 1
- Voice Query - Whisper
- why so many open file descriptors to the same file?
- cf/mistral/mistral-7b-instruct-v0.1 is only accepted Cloudflare Workers AI model
- Streaming Conversational Responses
- Hightlight stop working when perform infix search with fallback operation
- Error when using buckets on vector search "Could not find a field named `_vector_distance` in the schema for sorting."
- [Feature Request] Conversational Search (RAG) with a local LLM HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typesense.