Setting up apache basic authentication behind a reverse proxy
79
I've determined the problem was that I had not enabled the ProxyPassReverseCookieDomain directive:
ProxyPassReverseCookieDomain external_addr server1
Hope this helps someone in the future
Related videos on Youtube
Author by
eSp
Updated on September 18, 2022Comments
-
eSp over 1 year
I currently got the following piece of code:
captureFile = theCaptureFile; // If there is only 1 currency it gets the total right away if (captureFile.getTotalMoney().size() == 1) { Money totalMoney = captureFile.getTotalMoney().values().iterator().next(); totalAmount = totalMoney.getAmount(); currencyCode = totalMoney.getCurrencyCode(); } // If there is more than one currency, goes through every one, converts it to GBP and adds it to the total amount else if (captureFile.getTotalMoney().size() > 1) { Map<String, Money> totals = captureFile.getTotalMoney(); for (Entry<String, Money> money : totals.entrySet()) { try { totalAmount = totalAmount + money.getValue().getEquivalent(BASE_CURRENCY).getAmount(); } catch (CurrencyNotFoundException e) { LOG.error("Getting ExchangeRate:", e); totalAmount = null; break; } catch (ExchangeRateNotFoundException e) { LOG.error("Getting ExchangeRate:", e); totalAmount = null; break; } } }
When the code gets called, the first IF works just fine but, in case there are more than 2 currencies, I get a NullPointerException on the TRY bit. None of those methods have a return null so I'm guessing it is something wrong that I am doing on the mapping part to pull the values out.
Here are the other 2 methods that are pulled off:
public Money getEquivalent(String targetCurrencyCode) throws CurrencyNotFoundException,ExchangeRateNotFoundException { if (this.currencyCode.equals(targetCurrencyCode)) { return this; } return getEquivalent(CurrencyCache.get().getCurrency(targetCurrencyCode)); }
and:
public long getAmount() { return amount; }
Any help would be greatly appreciated, any more info you might need just let me know.
Many thanks in advance.
-
mklauber almost 13 yearsThe proxy match code is currently disabled. IT was from an attempt to move the authentication forward to the web facing server. This failed because I realized every edit was simply coming as an anonymous user. I did add the ProxyVia On with no luck.
-
Andreas Fester about 9 yearsCan you post the stack trace you get?
-
Kalaiarasan Manimaran about 9 yearsYou can change totalAmount = null; to totalAmount = "" in the catch blocks and give a try.why you want to make totalAmount to be null if for a particular iteration of loop is throwing the exception
-
riccardo.cardin about 9 yearsYou never check for nullability your variable. Something like
money.getValue().getEquivalent(BASE_CURRENCY).getAmount()
could generate a NPE very easily. -
eSp about 9 years@Andreas: java.lang.NullPointerException at CaptureFileInsertOracle.init(CaptureFileInsertOracle.java:46)
-
eSp about 9 years@KalaiarasanManimaran: Because I will later pass those to the DB and if it can't calculate I want it to be passed as null.
-
Stephen C about 9 years@eSP - that isn't a stacktrace. That is just the first line of a stacktrace ... and it doesn't offer any real clues.
-
-
mklauber almost 13 yearsI will do, as soon as allowed.
-
tucuxi about 9 yearsthat assumes that totalAmount is a Long or an Integer (we would need to see its declaration to know for sure) - an alternative explanation would be money.getValue() returning null
-
Sergey Kalinichenko about 9 years@tucuxi There is no assumption here:
totalAmount
is assignedgetAmount()
in the first branch, and OP showsgetAmount()
's signature, which returnslong
. In the exception handler OP assignsnull
tototalAmount
, its type must beLong
. -
tucuxi about 9 yearsplease correct me if I am wrong, but why would
long totalAmount
(note lowercase L) fail to compile? And why would money.getValue() returning null fail to account for the symptoms? -
Sergey Kalinichenko about 9 years@tucuxi if
totalAmount
werelong
, notLong
, this assignment from the exception handler would not compile:totalAmount = null;
Returningnull
frommoney.getValue()
would definitely account for the symptoms, but I think that it is a lot less likely, because OP uses exceptions rather than returningnull
s in situations where results are unknown (say, because the currency conversion fails). -
tucuxi about 9 yearsouch - should have seen it. I was looking for my clues further up.
-
eSp about 9 yearsWill try this approach first as I was under this same impression but disregarded it for some reason. Thanks, will come back with some feedback
-
eSp about 9 years@dasblinkenlight Many thanks, it worked like a charm. A lesson I won't forget (hopefully) =)