Skip to content

Add test for OPTIONS * handling.#28

Merged
samuel-williams-shopify merged 1 commit intomainfrom
options-star
Dec 5, 2025
Merged

Add test for OPTIONS * handling.#28
samuel-williams-shopify merged 1 commit intomainfrom
options-star

Conversation

@samuel-williams-shopify
Copy link
Copy Markdown
Contributor

@samuel-williams-shopify samuel-williams-shopify commented Dec 4, 2025

I wasn't sure how this was handled, so I added a test.

Types of Changes

  • New feature.

Contribution

@samuel-williams-shopify samuel-williams-shopify changed the title Add test for OPTIONS * handling. Add test for OPTIONS * handling. Dec 4, 2025
@samuel-williams-shopify
Copy link
Copy Markdown
Contributor Author

@CamJN @FooBarWidget I can't get Phusion Passenger to accept OPTIONS * but OPTIONS / does work:

> curl -X OPTIONS --request-target "*" http://localhost:3000 -v
* Host localhost:3000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:3000...
* connect to ::1 port 3000 from ::1 port 59649 failed: Connection refused
*   Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000
> OPTIONS * HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 400 Bad Request
< Server: nginx/1.26.3
< Date: Thu, 04 Dec 2025 22:58:19 GMT
< Content-Type: text/html
< Content-Length: 157
< Connection: close
< 
<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx/1.26.3</center>
</body>
</html>
* Closing connection


> curl -X OPTIONS --request-target "/" http://localhost:3000 -v
* Host localhost:3000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:3000...
* connect to ::1 port 3000 from ::1 port 59845 failed: Connection refused
*   Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000
> OPTIONS / HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< Content-Length: 9
< Connection: keep-alive
< Status: 200 OK
< allow: GET, POST, PUT, PATCH, DELETE, OPTIONS
< Date: Thu, 04 Dec 2025 23:01:37 GMT
< X-Powered-By: Phusion Passenger(R) 6.1.0
< Server: nginx/1.26.3 + Phusion Passenger(R) 6.1.0
< 
* Connection #0 to host localhost left intact
OPTIONS /

Is this a bug with Passenger? Why isn't it forwarding the request?

@samuel-williams-shopify
Copy link
Copy Markdown
Contributor Author

I merged #29 as it felt like a useful test and was working correctly across all servers.

@samuel-williams-shopify
Copy link
Copy Markdown
Contributor Author

I've decided to support explicit broken-ness and listed Passenger as having broken support for OPTIONS *. If it gets fixed, please let me know.

@samuel-williams-shopify samuel-williams-shopify merged commit f87f8fb into main Dec 5, 2025
20 checks passed
@samuel-williams-shopify samuel-williams-shopify deleted the options-star branch December 5, 2025 12:53
@CamJN
Copy link
Copy Markdown

CamJN commented Jan 19, 2026

@samuel-williams-shopify this turns out to be an nginx issue, if you use --engine builtin with passenger you get a valid response.

passenger start --envvar BUNDLE_GEMFILE="gems/passenger-v6-rack-v2.rb" --engine builtin

curl -X OPTIONS --request-target "*" http://localhost:3000 -v
* Host localhost:3000 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
*   Trying [::1]:3000...
* connect to ::1 port 3000 from ::1 port 61429 failed: Connection refused
*   Trying 127.0.0.1:3000...
* Connected to localhost (127.0.0.1) port 3000
> OPTIONS * HTTP/1.1
> Host: localhost:3000
> User-Agent: curl/8.7.1
> Accept: */*
> 
* Request completely sent off
< HTTP/1.1 200 OK
< Status: 200 OK
< allow: GET, POST, PUT, PATCH, DELETE, OPTIONS
< Date: Mon, 19 Jan 2026 15:54:34 GMT
< Content-Length: 9
< X-Powered-By: Phusion Passenger(R) 6.1.1
< 
* Connection #0 to host localhost left intact
OPTIONS *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants