Comments (5)
I am seeing an issue that is similar but it's also happening in async mode as well. I am getting the following error from nginx:
Invalid URL prefix in "should_get_overwritten", client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", host: "localhost:8080"
It's as if the rewrite handler is never getting called which results in the variable never being rewritten. Please see below for a gist of my setup.
here is a gist from my nginx.conf
http {
...
server {
....
set $destination "should_get_overwritten";
location / {
handler_type 'java';
rewrite_handler_name 'my.handlers.ProxyHandler';
proxy_pass $destination;
}
...
}
....
}
ProxyHandler gist:
public class ProxyHandler implements NginxJavaRingHandler {
private static final String DESTINATION_HOST = "destination";
private static final String URL = "http://google.com";
@Override
public Object[] invoke(Map<String, Object> request) {
System.err.println("============= Inside invoke =============");
String destinationHost = determineDestinationHost();
NginxJavaRequest r = ((NginxJavaRequest)request);
NginxClojureRT.setNGXVariable(r.nativeRequest(), DESTINATION_HOST, destinationHost);
return PHRASE_DONE;
}
private String determineDestinationHost() { return URL; }
}
few notes from documentation inaccuracies:
- documentation calls it: handler_rewrite_name which i have sense fixed to be called rewrite_handler_name
- I have to cast the incoming request as a NginxJavaRequest to get the nativeRequest in the java handler. This is not documented in the example provided
Intentions of what I am trying to do:
I am trying to achieve setting up a dynamically programmable reverse proxy
from nginx-clojure.
@ekubacki thank you very much!
I'll correct the document and try your example soon.
from nginx-clojure.
@ekubacki this issue won't happend in default mode.
You example meets issue #45 , I have fixed it just now by commit 6afeda3. The document has been corrected too.
Thanks again!
from nginx-clojure.
Thank-you for the correction in documentation :)
from nginx-clojure.
close it and we release v0.2.6 now.
from nginx-clojure.
Related Issues (20)
- java.lang.VerifyError happens when use mysql jdbc 8.0.32 on jdk19 + nginx-clojure 0.6.0 HOT 1
- NginxSharedHashMap.atomicAddLong return wrong value when value is very large
- remote debug not work on jdk 19 with coroutine mode
- Directives for jvm int/exit handler properties
- Enable coroutine context for invoking config method of a handler in coroutine mode
- Rewrite handlers can add/update request headers
- Dispatch incoming request to a jsp and set attribute HOT 2
- Support load-balancing handler
- Add new handler types to better support spring and spring boot
- nginx-clojure-embed need be compiled with more built-in nginx c modules HOT 1
- Proxy server error jvm may be mad for wrong options! See hs_err_pid****.log for detail! HOT 9
- How to debug/test nginx-clojure handlers
- StringFacedJavaBodyFilter/StringFacedClojureBodyFilter need auto decompress body when the body is compressed.
- java.lang.RuntimeException: can not create nginx handler for name HOT 4
- CVEs in maven artifact HOT 3
- nginx 1.25.0 build error HOT 3
- Support for random user ID in containerised environments - startup failure due to POSIX method getpwuid failure
- body content sometimes (!) missing in async content handler HOT 9
- Enhance hijack API to give users a chance to manage the closing of request body
- Running Nginx Clojure in Docker prompts: jvm may be mad for wrong options HOT 3
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 nginx-clojure.