Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom HTTP headers on static files #653

Merged
merged 3 commits into from
Mar 3, 2023
Merged

Add support for custom HTTP headers on static files #653

merged 3 commits into from
Mar 3, 2023

Conversation

Starfox64
Copy link
Contributor

This PR will enable users to add custom HTTP headers on files served from the public directory. This is important for production applications that could benefit from configuring a Cache-Control policy for their web assets. I have included an example policy to show how the new configuration option can be used.

This change should be backwards compatible as it checks if the new configuration option is present in config/octane.php.

@taylorotwell
Copy link
Member

What if you want different headers for different files?

@marden
Copy link

marden commented Mar 2, 2023

What if you want different headers for different files?

Yes, totally agree. I have real cases when different headers are needed.

@Starfox64
Copy link
Contributor Author

I added the ability to apply the headers based on a request path pattern. This is the same pattern system that is used by some of the base middlewares.

@taylorotwell
Copy link
Member

So there is no way to also add support for this in RoadRunner?

@Starfox64
Copy link
Contributor Author

Unless I'm missing something, it seems the RoadRunner implementation doesn't even serve static files in the first place.

@taylorotwell taylorotwell merged commit b8cbe93 into laravel:1.x Mar 3, 2023
@sneycampos
Copy link

@Starfox64 sorry for open a discussion on a merged PR but is not this in RoadRunner? https://roadrunner.dev/docs/middleware-static/2.x/en

@Starfox64
Copy link
Contributor Author

@Starfox64 sorry for open a discussion on a merged PR but is not this in RoadRunner? https://roadrunner.dev/docs/middleware-static/2.x/en

I guess the best way would be to just start Octane with --rr-config= : The path to the RoadRunner .rr.yaml file and use your own config file. Seems a lot more flexible than trying to wrap RR's config with Octane's.

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.

4 participants