[GH-ISSUE #44] unknown directive 'application/octet-stream' #19

Closed
opened 2026-02-28 01:20:32 +03:00 by kerem · 4 comments
Owner

Originally created by @ghost on GitHub (Mar 23, 2024).
Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/44

Hello,

When I add this into the nginx configuration in server block, the parser gives me unknown directive error:

    types {
        application/octet-stream mp4;
        application/octet-stream srt;
        application/octet-stream ass;
    }

exact error message: unknown directive 'application/octet-stream' on line 10, column 9

Is there anyway to skip this or even better make it parse this?

Thank you in advance.

Originally created by @ghost on GitHub (Mar 23, 2024). Original GitHub issue: https://github.com/tufanbarisyildirim/gonginx/issues/44 Hello, When I add this into the nginx configuration in server block, the parser gives me unknown directive error: ``` types { application/octet-stream mp4; application/octet-stream srt; application/octet-stream ass; } ``` exact error message: unknown directive 'application/octet-stream' on line 10, column 9 Is there anyway to skip this or even better make it parse this? Thank you in advance.
kerem closed this issue 2026-02-28 01:20:33 +03:00
Author
Owner

@ghost commented on GitHub (Mar 23, 2024):

As a workaround I did put them in a file and included them in the config.

<!-- gh-comment-id:2016297538 --> @ghost commented on GitHub (Mar 23, 2024): As a workaround I did put them in a file and included them in the config.
Author
Owner

@mofantor commented on GitHub (Mar 31, 2024):

You can use parser.WithSkipValidDirectivesErr to skip syntax checks, as in the following code snippet: parser.NewParser(filePath, parser.WithSkipValidDirectivesErr())

<!-- gh-comment-id:2028668029 --> @mofantor commented on GitHub (Mar 31, 2024): You can use parser.WithSkipValidDirectivesErr to skip syntax checks, as in the following code snippet: parser.NewParser(filePath, parser.WithSkipValidDirectivesErr())
Author
Owner

@ghost commented on GitHub (Apr 1, 2024):

You can use parser.WithSkipValidDirectivesErr to skip syntax checks, as in the following code snippet: parser.NewParser(filePath, parser.WithSkipValidDirectivesErr())

Shouldn't these be parsed? I mean I got issues with this and using variables in server blocks, I eventually switched to crossplane and parsed the whole nginx file then got my needed directive arguments but this would be very better as crossplane parsed whole nginx file instead of individual files.

<!-- gh-comment-id:2029886495 --> @ghost commented on GitHub (Apr 1, 2024): > You can use parser.WithSkipValidDirectivesErr to skip syntax checks, as in the following code snippet: parser.NewParser(filePath, parser.WithSkipValidDirectivesErr()) Shouldn't these be parsed? I mean I got issues with this and using variables in server blocks, I eventually switched to crossplane and parsed the whole nginx file then got my needed directive arguments but this would be very better as crossplane parsed whole nginx file instead of individual files.
Author
Owner

@tufanbarisyildirim commented on GitHub (Feb 20, 2026):

Re-checked on current master and this appears resolved.

I reproduced your exact case:

  • server { types { application/octet-stream mp4; ... } }

Parsing succeeds and dump output preserves those entries. I also verified the same inside http -> server -> types.

Closing as fixed in current code. If you still hit this on latest code, please reopen with a minimal config and the exact library version/commit.

<!-- gh-comment-id:3932172530 --> @tufanbarisyildirim commented on GitHub (Feb 20, 2026): Re-checked on current `master` and this appears resolved. I reproduced your exact case: - `server { types { application/octet-stream mp4; ... } }` Parsing succeeds and dump output preserves those entries. I also verified the same inside `http -> server -> types`. Closing as fixed in current code. If you still hit this on latest code, please reopen with a minimal config and the exact library version/commit.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/gonginx#19
No description provided.